Occasionally, you may run into a Visual Studio Class Library project that contains unit tests. This can be a frustrating scenario because creating a unit test using Visual Studio’s right-click context menus will not allow you to add a test to the project.
This can be remedied quite easily, though, by adding the correct project type guid to the Class Library’s project file. Here are the steps to do this from within Visual Studio:
- Right-click the project in Solution Explorer and choose Edit Project File
- Add a new child in the <PropertyGroup> node:
- Save your changes and close the file
- Right-click the project in Solution Explorer and choose Reload Project
After following those steps, your project will show in the list of output projects in the Create Unit Tests dialog box.
For a list of known project type Guids, check out this site: http://www.mztools.com/articles/2008/mz2008017.aspx
2 thoughts on “Convert a Class Library to a Test Project in Visual Studio”
Cheers Adam,just what I needed