Editing Visual Studio project files within the IDE

Posted: (EET/GMT+2)

 

There are certain situations when you might need to edit your Visual Studio project files. For example, you might wish to add a Win32 resource to your project, or might want to add a custom MSBuild task to your project file -- something you cannot do with the Visual Studio 2005 IDE directly. However, there's a problem with this: you cannot simply edit the XML based project file in Visual Studio without doing a simple trick first called unloading the project.

Now, when you load a project (solution) into Visual Studio, you can see the project's structure in Solution Explorer. Here, you can right-click your project, and select "Unload project" from the popup menu:

Next, the project goes into "Unavailable" mode, meaning the project is now effectively disabled. After this, right-click the project node again, and choose Edit [project], and then your .CSPROJ file open in the editor. Once you are done editing, simply save your file and choose Reload [project], and you are done!

PS. I also did a Finnish post on ITpro.fi about this.

Keywords: howto, how to edit Visual Studio project file, C#.