Visual Studio Tip: Editing Project Files

Earlier I mentioned tweaking project files -- something that a lot of people do just by opening the project file up in Notepad and tweaking it.  Although it's a bit hard to discover, you can actually do this right within Visual Studio 2005, saving you from switching between applications, and more importantly buying you color coding and intellisense on the project file.

To enable this, first right click on the project in Solution Explorer and choose "Unload Project". 

Unload a project in Visual Studio

This will cause the project node to grey out and be marked unavailable.  You can now right click on it and choose "Edit <project file name>", which opens the project file up in the Visual Studio XML editor and loads the MSBuild schema up for you.

Edit a project in Visual Studio

Once you've made your changes, save the file, right click the project again and chose Reload Project.

Reload a project in Visual Studio

Visual Studio will prompt you to close the project document, and assuming there are no errors in the file, the project will reload and your changes will take effect.  If there was an error, Visual Studio will give you a dialog indicating which line and column the error was in and a brief description of what went wrong.

In addition to using this for accessing features not available via the UI (as I mentioned in the strong name key post), I also tweak project files to invoke some custom MSBuild tasks that I use in personal projects.