Brave Location Mobile Apps and Web Solutions

Changing the type of a Visual Studio project

Originally posted on my old MSDN blog

The reason I’m blogging about this is that I was trying to do this the other day and I struggled to find the relevant information from ALL of the major search engines – including the one I work on. Now it could be that I was using the wrong search terms, but I wanted to capture the solution just in case I (or someone else) needs to do the same.

My problem was this. We were upgrading some Visual Studio project files from 2008 to 2010, although we wanted them to continue to use the 3.5 .Net runtime. This wasn’t a problem and all went pretty smoothly, except for one project that contained some NUnit unit tests which insisted it could now only build to 4.0.

After a bit of pondering, I finally realised what had happened. Initially the project was a Visual Studio test project before we’d switched to NUnit, but because it was now an upgraded “test project” it had also be compiled against the presumably updated test functionality in VS2010/.Net 4.0.

So the solution should be simple right? Just change the project type to be a “regular” project that compiles to a DLL and everything will be OK? Well yes, but as far as I could see there was no obvious way in the project settings in Visual Studio to fix this. Now it could be that I’m stupid - please let me know if I am! - but I had to resort to hacking the XML in the project file itself.

Unfortunately the project types are stored in the XML as GUIDs. Why? Very hard to say. However after much searching finally I found this very useful page which had a list of project type GUIDs that I needed. A big thank you to the author of that page - Carlos J. Quintero! I changed the GUID and was now allowed to compile to the runtime I wanted. Job done.

N.B. This blog post has now moved to https://writingontablets.com