If somebody like the post and its helpful in your work then, add comments.

Monday, March 23, 2009

Issue:“The feature name WebPart1 already exists in SharePoint. You need to rename the feature before solution deployment can succeed.”

This error happens even if you given a different name for your web part file and web part class file. This is because behind the scenes Visual Studio stores the solution name as Webpart1 even if you have given a different name to your webpart. To overcome this VS 2008 behavior, following changes have to be made to the webpart feature files
1. Change the name of webpart folder, webpart xml and webpart files from Webpart1 to the name of your web part for e.g. WP1. So in effect the folder WebPart1 will become WP1, the file WebPart1.webpart will become WP1.webpart and the file WebPart1.xml will become WP1.xml.
2. Select the Show All Files option from VS 2008 Solution Explorer tool bar.
3. Three additional folders namely bin, obj, pkg will be displayed in grayed out style.
4. Expand the pkg folder. Pkg folder will have a sub folder named Webpart1 and two XML files manifest.xml and solution.xml.
5. Rename Webpart1 folder name to your webpart for e.g. WP1
6. Edit solution.xml and change the name of feature from Webpart1 to your webpart name

No comments:

Post a Comment