86

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?

1

4 Answers 4

164

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

6
  • 3
    thanks for the response! That worked!!! :) I just edited the line: Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CCP Utility", "CCP Utility\CCP Utility.csproj", "{FE1F9ED8-F161-485F-B9E6-357852321137}" Mar 15, 2011 at 18:47
  • 12
    @DenisIvin Thanks so much. Please Microsoft make this easier Jul 11, 2012 at 21:42
  • 7
    It should be noted that this will remove your project from source control if it's under there previously Jun 20, 2013 at 8:01
  • 1
    In addition, you need to update the .csproj file for all projects that refer to the project for which you changed folder name. .csproj files are also text files, so that is easily done.
    – Godsmith
    Jan 7, 2014 at 15:43
  • @dougajmcdonald and passersby, I handled this by moving the project to a new directory using the source control program first.
    – kdbanman
    Aug 10, 2015 at 18:45
11

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
3

I found that these instructions were not enough. I also had to search through the code files for models, controllers, and views as well as the AppStart files to change the namespace.

Since I was copying my project not just renaming it, I also had to go into the applicationhost.config for IIS express and recreate the bindings using different port numbers and change the physical directory as well.

1

go to my start-documents-iisExpress-config and then right click on applicationhost and select open with visual studio 2013 for web you will get into applicationhost.config window in the visual studio and now in the region chsnge the physical path to the path where your project is placed

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.