views:

370

answers:

1

I'm trying to change a namespace in Visual Studio.

My folder structure looks something like this:

GameAlpha/
         GameAlpha.sln
         GameAlphaRelease/
         GameAlphaTest/
         GameAlphaLevelEditor/

These include namespaces like GameAlphaRelease. I want to change all this to GameBetaRelease.

Before this process, it built fine.

First, I changed the solution and project files from Alpha to Beta. Then, I did a "find-replace-all" on the namespace. Finally, I went through the properties of each project and changed the "Assembly Name" and "Default Namespace" to the appropriate Beta title.

However, now the solution does not build. The error is:

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

What am I doing wrong? If I remove project GameBetaTest, the solution builds just fine.

Also, what is the preferable way to change the names of the folders in the file system?

A: 

The follow steps normally work for me:

  • Use the standard project rename (this renames the project, but not the Project Directory). If you want to change the directory as well, close down the solution, rename the directory, open the solution, remove the old project (which is now unavailable) 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 any inter-project dependencies.

  • Adjust the project properties for each changed project.

  • Verify/adjust build scripts.

  • Verify/adjust the build order.

  • Clean and rebuild all.

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

pst