Convert a standard C# project into a Unit Test project

April 02, 2017

I recently (accidentally) created a Unit Test project as a standard C# class library. Although you don’t need to change this to a test library (it basically just gives you the test icon instead of the class icon), I felt that, if I wanted to do this, it shouldn’t require that I delete and recreate the project.

To change the project type

If you open the csproj for a class library, it looks like this (or some of it does):

[code lang=“xml”] Debug AnyCPU {93F28F24-AD9B-4839-8697-6DA48BAB2048} Library Properties MyProject.UnitTests MyProject.UnitTests v4.5.2 512

All you need to do is add the correct ProjectTypeGuids:

[code lang="xml"]


Profile picture

A blog about one man's journey through code… and some pictures of the Peak District

© Paul Michaels 2022