If you follow this technique, the basic steps to developing a deployable feature are:
- Make your web part page in the Sharepoint front end or Sharepoint designer
- Once development complete, export the page to a site solution file
- Copy the appropriate section to your Sharepoint deployment soluting project
So everything is fine, but then you deploy the solution, and ARGHH! it throws an error! Worse, it throws an "Unexpected Error". This is the least useful error message you can imagine. So whats the solution?
Well after going through all the XML for my features I found the following:
The highlighted line is:
When you deploy this solution to a site, the ID of the file is whatever the next ID available (it's basically an incremental integer). Therefore by leaving in this piece of declarative XML, we are attempting to force the file to use this ID. This is what is causing the "Unexpected error" on deployment.
Simply comment out this line and your solution will deploy.