May 052011
 

It can get pretty tricky to correctly rename a project in Visual Studio so that you can correctly commit the change back to Subversion. I always run into trouble with it, and so I’m recording the steps here so I don’t have to keep repeating the same mistakes.

  • Remove the project from the solution.
  • Use the Subversion Rename command to change the project’s folder to the desired name.
  • Use the Subversion Rename command to change the .csproj file to the desired name.
  • Add the project back to the solution.
  • Go to project’s Properties, and adjust Assembly Name and Default Namespace to match.
  • In code files, fix namespaces to match new name. If you own Resharper, you can select the project in Solution Explorer, and go to Resharper > Refactor > Adjust Namespaces and it will take care of it for you.
  • Rebuild the solution, and test to make sure you didn’t inadvertently FUBAR everything.
  • Commit to Subversion.

 

  3 Responses to “Rename Visual Studio project in Subversion”

  1. In case you are too lazy to do all these steps manually, there is a tool (prototype) I wrote exactly for this task. Also supports subversion for now. Check out http://normankosmal.com/wordpress/?p=54.

    Norman

  2. Interesting stuff Norman thanks for the link. If I ever end up needing to rename a bunch of projects again I will check out your tool.

  3. The version I have I can just rename the project or solution in the IDE. When I commit it just deletes the old name and adds the new one.

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>