My current solution for renaming the project folder is:
Is there a better way?
Visual Studio is not competent at renaming things. Open the project folder in any good text editor. Search-and-replace across the whole folder and replace and text occurrences of the old name with the new name. Sublime Text and Atom have a tree view where you can right click -> Search in folder.
Just right click on the name you want to change (this could be namespace or whatever else) and select Refactor->Rename... Enter new name, leave location as [Global Namespace], check preview if you want and you're done! Save this answer.
TFS users: If you are using source control that requires you to warn it before your rename files/folders then look at this answer instead which covers the extra steps required.
To rename a project's folder, file (.*proj
) and display name in Visual Studio:
.sln
file directly in another editor such as Notepad++ and update the paths there instead. (You may need to check-out the solution first in TFS, etc.)Note: Other suggested solutions that involve removing and then re-adding the project to the solution will break project references.
If you perform these steps then you might also consider renaming the following to match:
Also consider modifying the values of the following assembly attributes:
AssemblyProductAttribute
AssemblyDescriptionAttribute
AssemblyTitleAttribute
This is straightforward in Visual Studio 2015 (possibly works in older versions)
.sln
file in Notepad, and change the path to the csproj, i.e., fu\bar.csproj
→ bar\bar.csproj
.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With