Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is the Microsoft.VisualStudio.TestTools.UnitTesting namespace on VS2010?

I converted a VS2008 solution that contains some unit testing projects to VS2010. After the conversion I tried to compile the solution, but I'm getting the following error:

The type or namespace name 'VisualStudio' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

The namespace declaration cannot be found using Microsoft.VisualStudio.TestTools.UnitTesting;. In addition, I couldn't find the Microsoft.VisualStudio.QualityTools.UnitTestFramework assembly when I tried to add a new project reference.

Does anyone know what I'm doing wrong?

like image 491
CARLOS LOTH Avatar asked Jul 20 '10 18:07

CARLOS LOTH


People also ask

Where is Microsoft VisualStudio Qualitytools Unittestframework?

It can be found at C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies\ directory (for VS2010 professional or above; . NET Framework 4.0).

Which namespace is used in Microsoft Test Framework?

Test Automation Framework: Microsoft has its Unit Testing Framework implemented in a namespace which is Microsoft. VisualStudio. TestTools.

What is MSTestV2?

Uniform app-platform support – MSTestV2 is a converged implementation that offers uniform app-platform support across . NET Framework, . NET Core, ASP.NET Core, and UWP. Read more. The implementation is fully cross platform (Windows, Linux, Mac).

Does TestInitialize run for each test?

TestInitialize and TestCleanup are ran before and after each test, this is to ensure that no tests are coupled. If you want to run methods before and after ALL tests, decorate relevant methods with the ClassInitialize and ClassCleanup attributes.


2 Answers

It's called Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll.

You can find it in C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll.

like image 81
SLaks Avatar answered Oct 12 '22 16:10

SLaks


I just had this problem as well, and with a Microsoft.Data.Schema library as well. The answer is correct, in that these library are on the machine and in the VS 10.0 directory.

The problem (at least for me) was that the solution was converted from VS2008 and the conversion utility targetted the project for .NET 3.5. Since the 10.0 library require .NET 4.0 they are not picked up by the compiler.

The solution is to either revert to use VS2008 where these resolve correctly; or to switch the project to compile for .NET 4.0 so you can use the available libraries.

like image 37
Erik Brown Avatar answered Oct 12 '22 17:10

Erik Brown