Where to find “Microsoft.VisualStudio.TestTools.UnitTesting” missing dll?

后端 未结 12 1810
谎友^
谎友^ 2020-11-28 05:11

I am getting following error in my C# visual studio project:

The type or namespace name \'VisualStudio\' does not exist in the namespace \'Microsoft\'

12条回答
  •  [愿得一人]
    2020-11-28 05:29

    If you are using Visual Studio 2017 Community, the location is:

    C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\ReferenceAssemblies\v2.0

    The DLL you want is there: Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll

    Apparently it is located in the C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies\ directory for Visual Studio 2010 Professional version, but take note that the 10.0 will change to correspond with the release year, i.e. VS 2013 was version 12.0, VS 2015 was version 14.0, VS 2017 is 15.0. (VS Express is not supported and would require installing the NUnit NuGet package, through the NuGet Package Manager, instead.)

    You go to References, right-click, select Add Reference, Browse. Navigate to the path, then double-click the file.

    Then, you need a using statement at the top of your Unit Test class:

    using Microsoft.VisualStudio.TestTools.UnitTesting;

提交回复
热议问题