VS2012: How to change a project’s physical location

By jay at September 26, 2012 19:02 Tags: ,

Ce billet est disponible en francais.

Physically moving a project in a Visual Studio solution has always been cumbersome. It’s often needed if you rename your [insert favorite language] project’s folder.

In previous versions of Visual Studio, you would move the project into the new location and either :

  • Remove the project from the solution and add it back using the new location
  • Go the warrior way, and hack around the very user-friendly .sln file format and change all the references

That’s been an annoying situation, but that could be worked around.

But every time, you’d lose your solution wide settings, such as default startup project or build configuration. And if you have many build configuration, I think you understand the pain of restoring all these settings properly.

Fortunately, there’s been a very small change in VS2012 that allows to provide a new location of a project file, if it failed to load because it was not found.

To make this appear :

  • Close your solution in VS2012
  • Move your project to the new location
  • Open your solution
  • Select the project that failed to load
  • In the Properties tool window, there an editable “File path” entry that allows you to select the new project location
  • Set the new path
  • Right click on the project and click reload

 

You’re done !

Small improvement, big time saver when refactoring your solution !

blog comments powered by Disqus

About me

My name is Jerome Laban, I am a Software Architect, C# MVP and .NET enthustiast from Montréal, QC. You will find my blog on this site, where I'm adding my thoughts on current events, or the things I'm working on, such as the Remote Control for Windows Phone.