Edit project files from VS

Here is a cool trick I learnt recently. Most of the time if I need to edit the project files (csproj or vbproj)  manually I open them in notepad or any other text editor.

But what if one needs to edit a project file, while it is loaded in visual studio.

For standard .csproj and .vbproj files do the following:

  • Open the project in Visual Studio 2005
  • Right-click on the project in Solution Explorer and select Unload Project
  • Right-click on the project in Solution Explorer and select Edit <project file>
  • Once you are done editing Save and close the project file
  • Right-click on the project in Solution Explorer and select Reload Project

The benefit of this way is that you don’t need to close the solution and exit visual studio. As well since you are editing it from Visual Studio you get the syntax highlighting and nicely aligned xml file.

Advertisements