CAUTION:This information is outdated. Information about the VisualStudioProjectRenamer can now be found on the info page. The latest releases can be found and downloaded from the download page.
If you ever have tried to rename a project from within Visual Studio, you may have noticed that the renaming process doesn`t really do what you think it would. Renaming the project doesn’t change the assembly name, the root namespace or the physical project folder name. How ever, there are ways to do all these changes manually like Steve Andrews explains in this post.
I wrote a little tool, that does all the work involved in a renaming process. This is for now only tested on my machine and there is a good chance that it contains bugs. So if you download the tool and you find any bugs, please leave a comment and I will try to fix them.
This is how the tool looks after you have fired it up:

If you click the browse button, you can pick your solution file that contains the project you want to rename. Note that the project needs to be located physically under the solution folder.

After selecting the solution and clicking okay, you will see all projects of the selected solution in the combobox. From here you can pick the project that you want to rename:

In the textbox below the combobox you can enter the new name for the project:

If your project is under version control, and for now this tool only supports SVN, you may check the upper checkbox. The difference is, that internally the svn move command is used to rename projects and files, while if the checkbox is unchecked, directory move and file move commands are used.
If you want the changes to be checked in automatically, you may check the “check in changes” checkbox. If you dont, you will have to check in your changes yourself.
If you are satisfied with your new project name, hit the rename button. This will start renaming your project and depending on the checkboxes, check in your changes into your repository.
So how does it all work? There are a few steps that are executed in a chronological order. In the first step, all references to the old project in the solution file are getting replaced with the new ones. In the second step, the project folder is renamed into the new one. In the third step, the project file (.csproj) itself is getting renamed. In the fourth step, all references in the project file are getting replaced. The fifth step takes care of updating the AssemblyInfo.cs file, and replaces all occurences to the old name with the new one. The last step, takes care of adjusting the namespaces in all your class files.
The tool is coded against the .net 4 framework. To use some of its functions, you need to have svn installed. The automatic check ins only work if you have saved your svn credentials. Also I recommend to close the solution in visual studio. Otherwise the tool wont be able to rename the project folder, because visual studio has a handle on that folder while the solution is opened.
Since this is a prototype, there will be a lot changes in the future for example:
- Support more source control tools like tfs, git..
- Possibility to enter credentials for the repository..
- More validation..
- Rollback on error..
- Visual Studio extension..(which is already in the works but to be honest, the visual studio sdk api gives me a bit of a headache. There is not much documentation to it either, nor much tutorials.)

If you have any ideas or suggestions on how to improve the renaming tool, please feel free to leave a comment.
IMPORTANT:
There is no warranty by any damage this tool may cause. Use it on your own risk. This is a prototype. Always backup your data before using this programm. The Rollback on Error functionallity is not yet implemented. So be carefull.
You can download the prototype from my download page.




#1 by Johann on August 21st, 2011
Quote
Nice one, Norman. Good idea using svn mv.
#2 by Zasurus on September 6th, 2011
Quote
Any chance of getting the source for this so I we can modifiy it to use hg instead of SVN? :)
Great idea though! Can’t believe M$ didn’t bother! LOL
Thanks again
Zas
#3 by Norman on September 6th, 2011
Quote
Hi Zasurus,
I will see what I can do later this evening to grand access to the repository the code is hosted in. Will update this with the address later on.
#4 by Zasurus on September 6th, 2011
Quote
Thanks that would be great. :)
Zas
#5 by Norman on September 6th, 2011
Quote
Hi again,
here is the url to the source code http://riouxsvn.com/svn/vsprojectrename/. Unfortunatly its readonly. If you only want to implement your own Renamer that supports hg you can do it easily by using the VSPRBase.dll. There is a base class called “Renamer”. If you write your own class, that implements the logic to rename, all you need to do is inherit from the Renamer class. There are two abstract methods, which you will have to implement in your own class:
protected abstract void RenameProjectFile();
protected abstract void RenameProjectFolder();
In these methods you should put in the logic that uses hg move commands, I suppose.
All other methods in the Renamer class are marked virtual, so you can override them as well, if needed.
Check out the source code as well for examples. There are two specific Renamer classes, StandardRenamer and SvnRenamer in the base assembly, which kinda work the way I decribed above.
If you have any questions feel free to ask.
#6 by Zasurus on September 6th, 2011
Quote
Thanks again. Will have a look when I get a sec. :)
Thanks for sharing AND letting us get at the source code! :)
Regards,
Zas
#7 by Brian on October 16th, 2011
Quote
Did not work for me.
Log file had reference to a *.csproj file which does not exist in my project.
#8 by Norman on October 17th, 2011
Quote
Hi Brian
do you mind sending me the error log to razer21@gmx.de?
Cheers,
Norman
#9 by John on October 18th, 2011
Quote
Thanks you Norman, nice app
#10 by Paul on January 23rd, 2012
Quote
I was renaming a Solution with 3 projects.
The tool reported 2 projects were renamed without error.
The third one, the tool reported an error – but then appeared to rename the project anyway.
The error message in the tool said “An exception occurred during the renaming process, please check the Error.log”
The Error.log file present in the applications install directory did NOT get updated and remains an empty file.
Suggestions:
1 – Allow renaming the Solution, not just projects in a solution.
2 – Default the new name to the old name ( or at least give the option to do so ) so we can edit the name instead of having to type it in from scratch.
3 – error messages should be displayed in a control that will allow the users to copy the error.
#11 by Norman on January 24th, 2012
Quote
Hello Paul,
1) I think you can easily rename a solution from within visual studio itself. That is why it is not implemented in the tool.
2) Good idea. This goes into the next release.
3) You got a point here as well. I`ll see what I can come up with to improve this.
Thanks again for the feedback. Check back for the new version, which will be released in a few days I guess.
Norman
#12 by Norman on February 4th, 2012
Quote
Today I have released a new version of the tool: Please check out http://normankosmal.com/wordpress/?p=171
#13 by mr_miles on July 2nd, 2012
Quote
Hi,
I think I found a problem with the tool – if you start off with a solution that contains project names and folder names that are not the same, then it complains that the folders don’t exist and can’t do a rename.
It parses the solution file correctly, so I think it should take the folder names from the paths in there, rather than making this assumption.
Thanks otherwise for a great tool – can’t believe VS makes this so difficult!
miles
#14 by Norman on July 3rd, 2012
Quote
Hi Miles,
that is right. Using the path to the actual project from the solution file is actually on my todo list. Indeed, right now I am assuming that the folder is actually called the same as the project. This, as you have pointed out, is not always the case.
I´ll fix that in the next release. Thanks for your feedback.
On a side note and I quote you: “can’t believe VS makes this so difficult”.. since I started to write the renamer, I completely understand now why they never put in renaming functionality into visual studio for projects. It is indeed an extraordinary complex task, and sometimes i wish i never had started this :)
Regards,
Norman
Pingback: How to: Rename Solutions, Projects, and Items in Visual Studio 2010