How to change a SharePoint feature name in Visual Studio 2010

Relates to: Visual Studio 2010

The Situation

Unlike in Visual Studio 2007,  when you use Visual Studio 2010 to create a SharePoint feature and then deploy the solution, you’ll notice that the default feature name is in the format: ProjectName_FeatureName. I want to change this feature name so that it follows my own naming convention.

Get Started by Creating a Feature in Visual Studio 2010

Once you create a new project in Visual Studio 2010 based on a SharePoint template, you can add a feature to the project by right-clicking on the “Features” folder in the “Solution Explorer” view and then clicking “Add Feature”. In my example below, I created a new feature called Feature1:

Add Feature

Deploy the Solution

Deploy the solution by right-clicking on the solution and then clicking “Deploy”.  You’ll notice in the “Features” folder in the 14 hive that the feature follows the  format: ProjectName_FeatureName:

Deploying Solution

Change the Feature Name

To change this name, double-click on the feature in the “Solution Explorer” view to display the feature properties. Under properties, you’ll see the feature’s “Deployment Path” property, which by default is set to:

$SharePoint.Project.FileNameWithoutExtension$_$SharePoint.Feature.FileNameWithoutExtension$

The first token is the project name and the second token is the feature name. Change the feature so that the name is only set to the feature name by setting the “Deployment Path” to:

$SharePoint.Feature.FileNameWithoutExtension$

When you deploy the solution again, you’ll see that the feature in “Features” folder will actually match the feature name in the project:

feature Folder

Conclusion

In Visual Studio 2010, you can change the default SharePoint feature name by setting the feature’s “Deployment Path” property to only the feature name token.


Advertisements

5 Responses to How to change a SharePoint feature name in Visual Studio 2010

  1. waleed badawy says:

    thanks Jaclyn, good job

  2. Dipanjan Ghosh says:

    Good one Jaclyn, nice and neat trick, it’s not quite obvious….

  3. Charles says:

    Jaclyn, thanks for having this out here. Kind regards.

  4. Victor says:

    Thank you for a consistant guide!

  5. Harish says:

    thanks jacklyn..really helpful.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: