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.

Comments (11)
  1. Matthew says:

    Fantastic tip. This is going to save me a heap of time when I need to change all my project level error / warning settings using Find and Replace in the IDE.

  2. Chuck Huff says:

    What version of Visual Studio does this tip work for?

  3. This is in Visual Studio 2005.


  4. CoqBlog says:

    Shawn Farkas nous livre une astuce pour &#233;diter les fichiers csproj directement&#160;sous VS au lieu de d&#233;gainer…

  5. We all know that the CLR provides many types of evidence to assemblies and AppDomains by default, but

  6. Glen Martin says:

    Hello, I was attempting to use these steps on a C# project in VS 2005. I am getting a different behavior than expected. I am not seeing the Unload project in my right click context menu. Any ideas?

  7. Olaf Liebe says:

    @Glen Martin: I have the German and English version of VS 2005 installed. The menu entry only shows up, when I switch to the English version of VS.

  8. Wow, what a nice post. Second, I want to answer Mr. Glen Martin that you can see the Unload Project option when you have more than one projects added in your Solution Explorer. You can add another project by following these steps.

    1) Goto File -> Add.

    2) Select New Project / Existing Project.

    After adding another project if you try again then you will see the Unload Project option.

Comments are closed.

Skip to main content