Welcome to MSDN Blogs Sign in | Join | Help

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.

Published Wednesday, April 26, 2006 7:00 AM by shawnfa
Filed under:

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# re: Visual Studio Tip: Editing Project Files

Wednesday, April 26, 2006 8:03 PM by Matthew
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.

# re: Visual Studio Tip: Editing Project Files

Thursday, April 27, 2006 10:48 AM by Chuck Huff
What version of Visual Studio does this tip work for?

# re: Visual Studio Tip: Editing Project Files

Thursday, April 27, 2006 2:53 PM by shawnfa
This is in Visual Studio 2005.

-Shawn

# Astuce : Editer les fichiers projets directement sous Visual Studio 2005

Friday, April 28, 2006 6:09 PM by CoqBlog
Shawn Farkas nous livre une astuce pour &#233;diter les fichiers csproj directement&#160;sous VS au lieu de d&#233;gainer...

# Interesting Finds (oS edition) 2006/04/26

Saturday, April 29, 2006 5:24 PM by Jason Haley

# Interesting Finds (oS edition) 2006/04/26

Saturday, April 29, 2006 5:33 PM by Jason Haley

# Assembly Provided Evidence

Tuesday, February 20, 2007 2:14 PM by .Net Security Blog

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

# re: Visual Studio Tip: Editing Project Files

Tuesday, February 20, 2007 3:08 PM by Glen Martin

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?

# re: Visual Studio Tip: Editing Project Files

Tuesday, May 22, 2007 5:03 PM by Olaf Liebe

@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.

Leave a Comment

(required) 
required 
(required) 
 
Page view tracker