Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to rename a project without killing solution

When I rename a project within a solution, and then try and build that project, I get the error: "The project file "xyz.csproj" was not found. Where xyz is the old project file name!

The annoying thing is that I can search my project & solution for the old project file name, and the search will come up with nothing, and when I click on the error VS does nothing.

So there seems to be no way of finding where the old reference is.

This is a .web project hosting a silverlight page, if that makes any difference.

like image 609
Grayson Mitchell Avatar asked Jul 09 '10 00:07

Grayson Mitchell


People also ask

How do I rename a project in Solution?

Right click on the solution and click on Rename. Similarly, do it for the project as well.

How do I rename an entire Xcode project?

Click on the project you want to rename in the "Project navigator" in the left panel of the Xcode window. In the right panel, select the "File inspector", and the name of your project should be found under "Identity and Type". Change it to your new name.


2 Answers

These are steps I follow when I rename a project:

  1. Click on the project in the solution and rename it. This renames the .proj file and the project name(but not the directory containing the project).
  2. Close solution, rename the project folder. At this stage, the solution still references the old folder.
  3. Open sln file and replace the old folder name with the new one. This should only be in one place. it will look something like this.
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SolutionName", "OldProjectName\NewProjectName.csproj", "{98644DD0-5AB5-4CAC-8D83-CCB8EEEFE234}"

You will need to make it look like this:

Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SolutionName", "NewProjectName\NewProjectName.csproj", "{98644DD0-5AB5-4CAC-8D83-CCB8EEEFE234}"
like image 117
Igor Zevaka Avatar answered Sep 30 '22 14:09

Igor Zevaka


With all visual studio projects, you can usually just close visual studio, edit the solution/project files with a text editor, and reopen visual studio. They're just XML. As long as you're careful not to change anything major, a search & replace in a text editor should do the trick.

like image 40
sunetos Avatar answered Sep 30 '22 15:09

sunetos