SharePoint + Visual Studio - cannot rename Feature folder

Mon, Dec 11, 2017 One-minute read

When you Add Feature in Visual Studio, it by default creates a ‘folder' with some gubbins underneath it. By default this is Feature1.

This is pretty ugly, but you may encounter a scenario where you cannot rename it. It seems to be based on other characters that exist in the path of the solution/project. For instance, we tend to use full stops to delineate a pseudo namespace. Now amount of Right-Click > Rename will sort it.

There does (of course) appear to be a filthy little hack to get around it.

  • Exclude feature from the project - it will disappear in the project tree but will still visible if you click “Show All Files”
    1. Rename file “Feature1.feature” and its parent folder via the properties window or right click on the feature file and select “Rename” option.
  • Make sure that file “Feature1.feature” and its parent folder have the same names e.g. “ListsAndContentTypes.feature” for feature file and “ListsAndContentTypes” for the parent folder
  • Right click on the parent feature folder (in example above “ListsAndContentTypes” ) and click “Include in project” Now the feature file have appropriate name.
  • Make sure that it is included in the package - check the “Package” project item.

Worked for me.

Solution found here.