Tuesday, June 22, 2010

Reuse a Feature Solution

Either upgrading a wsp from 2007 or just simply copy-paste the folder to create a new feature from a starting point of another, will end up in solution and feature id errors such as:

(using my2010thingy as the name of the wsp as example)

A solution with the same name "my2010thingy.wsp" or id "xxx-x-x-x-xxx" already exists in the solution store.
my2010thingy.wsp: The Solution installation failed.

If the time lost creating everthing from scratch is unberable, try this:

1) open "my2010thingy.csproj" on the root folder
2) search for feature and package ids at the bottom and change them using the Visual Studio guid tool to trow registry-type guids (keep the old guids somewhere!)
3) go throw the folders in the solution, changing the old feature and solution(now package) ids for the new ones:
- Features\[Feature_Name]\Feature.feature
- Package\Package.package
Now you may try repackaging, but I normally change the ids also in the existing package folders just to make sure I don't run into conflicts
- pkg\Debug\[Solution_Name]\manifest.xml
- pkg\Debug\[Solution_Name]\[Feature_Name]\feature.xml
- pkgobj\Debug\[Solution_Name]_[Feature_Name].xml
- pkgobj\Debug\Package_Manifest.xml
- pkgobj\Debug\TokenReplaceFolder\manifest.xml
- pkgobj\Debug\TokenReplaceFolder\[Feature_Name]\feature.xml

No comments:

Post a Comment