Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio - How to change a project's folder name and solution name without breaking the solution

I am creating a project based off an old project because it has a lot of the functionality that I am required to use.

I want to rename all the directories and solution names to have the name of the new project. Under Documents\Visual Studio 2008\Projects I was able to change the initial directory and solution file names, but not the name of the subdirectory which houses the bin, obj, and properties folders. When I change the name of that subdirectory, none of the files will open when I open up the solution.

How can I change the project's folder name inside Visual Studio 2008 so that it will load all the files as part of the solution and still work?

like image 461
Brian McCarthy Avatar asked Mar 15 '11 17:03

Brian McCarthy


People also ask

How do I Rename a Visual Studio project solution?

Open the solution in VS by double clicking the project1. sln file. In Solution Explorer, right-click the project (NOT the solution!!!), select Rename, and enter a new name.

How do I change the project folder in Visual Studio?

In Visual Studio, click Tools > Options. Expand Projects and Solutions and click Locations. The Projects location field defines the default location for storing new projects. You can change this path if you are using a different working folder.

How do I change the project name and namespace in Visual Studio?

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!


2 Answers

You could open the SLN file in any text editor (Notepad, etc.) and simply change the project path there.

like image 55
Denis Ivin Avatar answered Oct 14 '22 13:10

Denis Ivin


This is what I did:

  1. Change project and solution name in Visual Studio
  2. Close the project and open the folder containing the project (The Visual studio solution name is already changed).
  3. Change the old project folder names to the new project name
  4. Open the .sln file and the change the project folder names manually from old to new folder names.
  5. Save the .sln file in the text editor
  6. Open the project again with Visual Studio and the solution is ready to modify
like image 23
Tariq Avatar answered Oct 14 '22 13:10

Tariq