Editing MSBuild project files in Visual Studio


Being able to edit your Visual Studio generated projects is one of the fundamental goals of MSBuild.  Being able to edit your project file to customize and extend is not something that just happened to work 🙂 MSBuild and Visual Studio 2005 were designed right from the start to enable you to do this.  If you ask me, this is the “essence of MSBuild”


So let’s say you are working on your project, and have your project loaded in the IDE – What’s the easiest way for you to be able to quickly drop into the MSBuild project file (either .csproj or .vbproj) so that you can edit the project to customize your build?


Pretty simple – if you are using one of the builds past the June CTP, you can do this in two steps.


1. Right click on your project in solution explorer and select Unload Project


2. Right click on the project (tagged as unavailable in solution explorer) and click “Edit yourproj.csproj”


It’s that simple.  No more notepad.  No more File->Open->blah->blah->blah.  Besides, you get full inellisense based on the MSBuild schema!  Wait – there’s something better.  We will not touch any of the customizations you make to your projects.  Customizations will work inside the IDE as well as from the command line – but we will not mess with your changes!


[Author: Faisal Mohamood]

Comments (12)

  1. Is there an easy way to check out the project file from TFS without checking every single file in the project? That would be rather handy..

  2. Serge Baccou says:

    Thanks a lot. This tip is very useful. I have blogged about this…

  3. Scott Munro says:

    Anyone who has edited Visual Studio project xml using Notepad (the no man’s land of intellisense) will…

  4. test says:

    Final update Sorry, I’m not able to figure out what’s wrong with this, and since Frank has a better solution

  5. test says:

    Been pulling my hair to find an way to open up a .csproj file in the Visual Studio 2005 IDE. After lots

  6. Smöråkning says:

    Been pulling my hair to find an way to open up a .csproj file in the Visual Studio 2005 IDE. After lots

  7. Smöråkning says:

    Final update Sorry, I’m not able to figure out what’s wrong with this, and since Frank has a better solution

  8. raj says:

    Is there any way to do same through the command line. I have to add some files dynamically to project file.

  9. chaiguy1337 says:

    For some reason my VS (2008) won’t let me open up the project file. Something’s broken: I can unload and select the menu item, but nothing happens when I do. I’ve tried running devenv /resetskippkgs from the command line but that didn’t help… any ideas?

  10. chaiguy1337 says:

    Aha, appears to be a glitch with WiX: when I have a WiX project loaded I can’t edit the .csproj for another project, but if I unload the WiX project I can. Disregard my previous message. 😛

  11. Tomas says:

    That’s maybe the best VS tip I’ve ever stumbled upon. Thanks!