Can't create test in VS2013, no Microsoft.VisualStudio.TestTools.UnitTesting namespace

Josh picture Josh · Dec 20, 2013 · Viewed 9.5k times · Source

I'm new to C#, .NET and VS; using VS 2013 Ultimate. I'm trying to create a unit test using what seems to be the "VS way" but can't figure it out.

It looks like the culprit is that I don't have access to the Microsoft.VisualStudio.TestTools.UnitTesting.Assert method or enclosing namespace... I've looked all around and can't find any references to this namespace. Is this something extra I need to install? At this point I have no idea what to look for.

I'm working around it with additional Main methods, which is a huge PITA...

Answer

Brandon picture Brandon · Dec 20, 2013

welcome to .NET development!

By default, Visual Studio will add references to the most common namespaces/classes to your project when the project is created. TestTools.UnitTesting is not one of those namespaces, so you'll have to add a reference to the file where it lives, which is in Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll.

Check out this thread for how to add references (I think your question duplicates it):