Deborah's Developer MindScape

         Tips and Techniques for Web and .NET developers.

June 30, 2010

Solution Files: Change Project Directory Location

Filed under: C#,VB.NET,Visual Studio @ 6:21 pm

Renaming or moving files in Visual Studio is never an easy task. But one of the lesser known enhancements in Visual Studio 2010 is the ability to change the directory location of a project.

Here is the scenario. The team decides that the projects need to be renamed. To keep things consistent, the directory file locations for those projects are also renamed. In this example, the projects and project folders were all renamed to include a prefix of "ACM."


So now you open the project and get this:


Notice that all of the projects are marked as "unavailable". This is because the solution file contains a path to each of the projects and that path is not longer correct because it was renamed.

In prior versions of Visual Studio, you would then need to manually edit the solution file to fix these issues. But Visual Studio 2010 provides an editable File path property. So you can edit the location of the files directly from within Visual Studio.

Select the project to update. Then view the Properties Window. Click on the … icon in the File path property to edit the project path and/or file name.


NOTE: The File path property is ONLY available for edit if the project is shown as "(unavailable)" in the Solution Explorer. In all other cases, the File path property is read-only.

After you are finished editing the path, right-click on the project in Solution Explorer and select Reload Project.

This is much easier (and less error prone) than hand-editing the project file.


EDIT: Added a note to make it clear that this is ONLY available if the project is defined as "unavailable". Otherwise the File path property is read-only.


  1.   Todd Hlavacek — November 2, 2012 @ 7:35 pm    Reply

    Here’s how I did it with VS2010:

    1. Close the solution in VS2010
    2. Rename the folder to whatever you want (back it up though)
    3. Open Solution in VS2010
    4. Project will now show up as unavailable and show up at the end of the Solution list
    5. The file path is now editable. CHange it to the newly renamed folder.
    6. Reload the project
    7. Do a test build/rebuild of the project, and then the solution to make sure they work

    That worked for me.

RSS feed for comments on this post. TrackBack URI

Leave a comment

© 2017 Deborah's Developer MindScape   Provided by WPMU DEV -The WordPress Experts   Hosted by Microsoft MVPs