How to rename a folder in Visual Studio 2012 and 2013

How to rename a folder in Visual Studio 2012 and 2013

It is quite easy to rename a project, folder or file from within Visual Studio. However if you rename a folder for one of your projects outside of VS you might encounter some headache – such as not being able to load the given project into your solution.

Let’s say you have a project named CoolProject and you want to change it to SuperCoolProject. You can start by right-clicking on the project and rename it.

CoolProject
SuperCoolProject

Then proceed to rename the folder on disk as well however this is when troubles kick in because once you do so Visual Studio will complain when you open the project the next time.

coolprojectnotfound

Solution:
Open your .sln file (Type: Microsoft Visual Studio Solution) in a text editor, Notepad will do, and edit the path to match your newly renamed folder name.

Look for lines similar to this:

Project("{ZA30GGR-1344-11D3-B5B5K-001114VGHDZGGFA}") = "CoolProject", "CoolProject.csproj", "{AAAA-AAA-1234-56789-BBBBBBBB}" EndProject

So if you renamed your folder to SuperCoolProject you’ll have to change it to this:

Project("{ZA30GGR-1344-11D3-B5B5K-001114VGHDZGGFA}") = "SuperCoolProject", "CoolProject.csproj", "{AAAA-AAA-1234-56789-BBBBBBBB}" EndProject

Notice however I didn’t change the last part ‘CoolProject.csproj‘, Visual Studio will change this itself when you rename your project from within by right-clicking on the project and choosing to Rename.

That’s it, quite simple.