Prasad Bolla's SharePoint Blog

Click Here to go through the Interesting posts within my Blog.

Click Here to go through the new posts in my blog.

Thursday, December 01, 2011

Important Error we will get while working with features in SharePoint



Feature definition files must be named 'feature.xml'

Recently I was trying to manually install a custom MOSS feature (by running STSADM.EXE from the command line), but I simply couldn't get it to work. The error returned by STSADM was: "Invalid file name. Feature definition files must be named 'feature.xml'". Normally I deploy features using the BAT-files that are part of the workflow projects I'm creating, so this was a first for me...
I edited the contents of the feature.xml file, renamed it from Feature.xml to feature.xml, and made other changes as well. Finally I tried to explicitly specify the current directory so I modified the STSADM parameter to include ".\" and then a new error appeared.

C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\RegisterPolicyResource>STSADM.EXE -o installfeature -filename .\feature.xml -force
Failed to find the XML file at location '12\Template\Features\.\feature.xml'

I then realized that the problem was that STSADM wanted to have the filename given to it relative to the directory C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES, regardless of where you are located when you run STSADM. So the solution was to change the call to: STSADM.EXE -o installfeature -filename RegisterPolicyResource\feature.xml -force

So the problem wasn't really that the the definition file wasn't named feature.xml, but that I ran STSADM assuming that the feature.xml whould be relative to the directory I was running STSADM from.

No comments:

Post a Comment