How to convert a test project to a normal class library


Sometimes you make mistakes. One of the ones I make most often while using Visual Studio is creating a new project of the wrong type. Usually, creating using just the same one I usually created.

And just now, I added a unit test project to a project I was working on. Great, so that’s one job done. Now I needed to add the class library it was going to test – and added another unit test library. Doh!

Turns out this is fixable – simply edit the project file (the “Productivity Power Tools” extension provides a shortcut to this, if you don’t have it already) and remove the line:
    <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
then save and reload the project – which turns out to be easier than I thought.

Can’t claim I invented this trick – I found it the other way round on Adam Prescott‘s blog. But I’m putting it here because I know I’ll forget it, next time I need it.




Archives