Wednesday, April 11, 2012

doctoring .csproj files in notepad!

If you right-click on the solution for a web forms project in Visual Studio 2010 and look at the properties you should see settings like so:

 
 

Yesterday I pulled something messed up out of source control in which a web forms project read as though it were a class library and thus could not be used as the startup project. There was no way to set it to be of the appropriate project type at the settings either.

 
 

The fix:

  1. I made a new web forms project.
  2. I opened the .csproj file for the new project in notepad and pasted the three nodes for PropertyGroup into a second, different notepad document.
  3. In the second notepad document, I did a "find and replace" to make all references to the new web forms project instead use the name of the first web forms project.
  4. I opened the .csproj file for the first web forms project and replaced only the PropertyGroup XML nodes (with the copy from the notepad document which only held redacted nodes).
  5. I got rid of the new web forms project I made. I was able to run the original web forms project as the start up project.

No comments:

Post a Comment