Converting a NUnit project to Microsoft UnitTest project
When you want to convert an existing VS2003 NUnit project to VS2005, this seems fairly simple. Just add existing project and let the upgrade wizard do its work. After that, set the correct references (Qualitytool etc), replace the using of the NUnit namespace and use the new attributes (TestClass and TestMethod instead of TestFixture and Test).
However, VS2005 will not recognize the new project as a test project, but just as a plain library project. After some project file differencing, I found out why.
A project of type ‘Test’ includes some magic guids. Paste these in your UnitTest project file using your favorite editor and you’re good to go.
The magic line is this:
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
I’m wondering why they did this, instead of just checking for the existence of classes with the correct attributes… Maybe a performance thing? On the other hand, a test project can also contain other things that are not coded in a .NET language, so having a specific indication in the projectfile makes sense from that point of view.
As it turns out, the Guids are not really magic after all. They are defined in the registry (of course :-)) under HKEY_LOCAL_MACHINESOFTWAREMicrosoftVisualStudio8.0Projects
It then becomes clear that the first guid means ‘Test project’ and the second ‘CSharp’.