Change namespace / file system folder names in Visual Studio

I am trying to change the namespace in Visual Studio.

My folder structure looks something like this:

GameAlpha/
         GameAlpha.sln
         GameAlphaRelease/
         GameAlphaTest/
         GameAlphaLevelEditor/

      

These include namespaces such as GameAlphaRelease

. I want to change all of this to GameBetaRelease

.

Before this process, it was created perfectly.

First I changed the solution and project files from Alpha to Beta. Then I did "find-replace-all" in the namespace. Finally, I looked at the properties of each project and changed the "assembly name" and "default namespace" to the appropriate beta title.

However, no solution is being built now. Error:

GameAlpha.accessor: A reference to 'GameAlpha.exe' was not found in the list of these projects. (Project: GameBetaTest)

What am I doing wrong? If I delete the GameBetaTest project, the solution is just fine.

Also, what's the preferred way to change the folder names on the file system?

+2


source to share


2 answers


The following steps work for me:

  • Use standard project rename (this renames the project, but not the project directory). If you want to change the directory, close the solution, rename the directory, open the solution, delete the old project (which is no longer available) and add the project from the new location.

  • For each project for which it applies, remove and re-add references to other projects in the solution if there are dependencies between projects.

  • Adjust the project properties for each changed project.

  • Check / correct build scripts.

  • Check / adjust build order.

  • Clean up and rebuild everything.



If you are doing a package / class rename, make sure you do it separately (before that, while everything is "still running") so that VS will update internals as needed. YMMV, and there are some problems with files "linked" between projects.

+2


source


Rename the physical project directory

Note. The physical path property is written to the .sln file, so you can't just rename the folder in explorer.

and. Close the solution and IDE

b. In explorer: change the directory name to the new name.

from. In explorer: open the .sln file with a text editor.



from. Change the name of the directory to the new name and save.

e. Restart the IDE and open the solution from the File, Recent Files menu if it doesn't start automatically.

f. Click the Project folder in Solution Explorer and check the path property in the properties below. It will now link to the new project folder.

This is where I found it

0


source







All Articles