Can I rename a project in Visual Studio so that its folder name is also renamed?

Suppose we are working on a MyProject project. I would like to be able to change its name to MyProject2 and the name of its folder is also renamed MyProject2.

Is this possible from Visual Studio? If not, how can this be done "out"?

+7
source share
5 answers

Rename the project to a new name. It will automatically change the .csproj file, which in 2010 is the name of the project. Close Visual Studio. Rename the directory.

Open the solution file to change the directory. Your solution file will point to a new project, but will link to the wrong directory.

Before:

Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Stackoverflow_4560662_Rename", "Stackoverflow_4560662\Stackoverflow_4560662_Rename.csproj", "{7CCD10BF-48BA-44E2-B071-D4ED8067ACA1}" 

After

 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Stackoverflow_4560662_Rename", "Stackoverflow_4560662_Rename\Stackoverflow_4560662_Rename.csproj", "{7CCD10BF-48BA-44E2-B071-D4ED8067ACA1}" 

Notice the two parts of "Stackoverflow_4560662 \ Stackoverflow_4560662_Rename.csproj" becomes "Stackoverflow_4560662_Rename \ Stackoverflow_4560662_Rename.csproj

This is the only way to rename the directory for the project. Hope someone finds a better answer.

+8
source

There may be one solution below.

  • Close the solution.
  • Rename folders outside of Visual Studio.
  • Open the solution, ignoring the warnings.
  • Complete all inaccessible projects.
    • Set the File Path property to a new location.
    • Reload the project.
    • If you have not renamed the project, rename it (F2).

Check answer

How to rename a project folder from Visual Studio?

+3
source

I am pretty new to this, but I had the same problem, I decided to just copy and paste my code into a new project and save it using the new name I need. This is probably not the best method, but it is simple and works.

+1
source

Not sure if this helps anyone but everything I did, rename the solution and its related folders, etc. Unfortunately, when you open, he says that he cannot find your project (s). To get around this, I opened my solution in a text editor (notepad ++) and renamed it where it finds the project. And it works.

Andy

0
source

Assuming you are talking about one VB.NET project in a solution.

AFAIK, you should not rename the My Project folder, this is the default name VS for the entire VB.NET project.

Just select the project / solution in VS Solution Explorer and press F2 to simply rename it.

-one
source

All Articles