简体   繁体   中英

Renaming project / solution in Visual studio

I want to rename the project/solution name for example from Project1.sln to Project2.sln

Is that just simply by going to View > Properties Window then rename the Name property or there is an additional step?

Renaming projects could be challenging in visual studio, as vanilla visual studio won't help you much. (Read = manual editing files)

If you also want to rename the file system folder, you will have to do a lot of manual steps:

  • Rename project folder outside Visual Studio.
  • Change project name in solution file (.sln)
  • Change project name in other projects which referenced(used) to it
  • Rename project file name
  • Change assembly name and information
  • Change default/root namespace

If like most of us your namespaces are based on project names then you will need to rename all your namespaces to match. You will also need to change the default namespace of the project in the properties.

Or you use a tool that I wrote for myself, that also deals with renaming in git so the history is not lost, moving to different directories etc.

Install via dotnet tool install -g ModernRonin.ProjectRenamer , see https://github.com/ModernRonin/ProjectRenamer for documentation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM