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:
- Close the solution.
- Rename the folder(s) outside Visual Studio. (Rename in TFS if using source control)
- Open the solution, ignoring the warnings (answer "no" if asked to load a project from source control).
- Go through all the unavailable projects and...
- Open the properties window for the project (highlight the project and press Alt+Enter or F4, or right-click > properties).
- Set the property 'File Path' to the new location.
- If the property is not editable (as in Visual Studio 2012), then open the
.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.)
- Reload the project - right-click > reload project.
- Change the display name of the project, by highlighting it and pressing F2, or right-click > rename.
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:
- Assembly
- Default/Root Namespace
- Namespace of existing files (use the refactor tools in Visual Studio or ReSharper's inconsistent namespaces tool)
Also consider modifying the values of the following assembly attributes:
AssemblyProductAttribute
AssemblyDescriptionAttribute
AssemblyTitleAttribute
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…