“Microsoft.VisualStudio.TestTools.UnitTesting”누락 된 dll를 찾을 수있는 곳
C # Visual Studio 프로젝트에서 다음과 같은 오류가 발생합니다.
네임 스페이스 'Microsoft'에 형식 또는 네임 스페이스 이름 'VisualStudio'가 없습니다 (조립품 참조가 없습니까?).
또한 microsoft.dll 파일을 찾으려고했지만 아무 참조도 얻지 못했습니다. 잘못된 DLL을 검색하고 있습니까?
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Kya.MsFx.Services.Swiper;
namespace Kya.MsFx.Devices.Swiper.Test
{
[TestClass]
public class SwiperWindowTest
{
private SwiperWebServiceHost m_SwiperWS = null;
/// <summary>
/// start web service on a separate thread, so tests
/// can be executed withut blocking the application thread
/// </summary>
[ClassInitialize]
public void SetupSwiperTests() {
m_SwiperWS = SwiperWebServiceHost.StartService();
}
/// <summary>
/// Stop service started during class initialize and kill the thread
/// </summary>
[ClassCleanup]
public void CleanupSwiperTests() {
m_SwiperWS.Stop();
}
/// <summary>
/// simulate init, swipe, clear operations
/// </summary>
[TestMethod]
public void TestSwiperService()
{
MessageBox.Show("test");
}
}
}
에 대한 참조를 추가해야합니다
Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
"C : \ Program Files \ Microsoft Visual Studio 10.0 \ Common7 \ IDE \ PublicAssemblies \"디렉터리 (VS2010 Professional 이상, .NET Framework 4.0)에서 찾을 수 있습니다.
또는 프로젝트를 마우스 오른쪽 버튼으로 클릭하고 참조 추가 ...> .NET :을 선택하십시오.
나는 이것이 오래되었다는 것을 알고 있습니다. 이것이 Google 검색에서 나온 것입니다. NuGet에서 이러한 패키지를 참조해야했습니다.
해당 네임 스페이스가 포함 된 찾고있는 DLL은
Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
Note that unit testing cannot be used in Visual Studio Express.
There is also a nice nuget package. It will pull the dll to your packages folder. You will need to add the reference to the dll manually.
NOTE: This package is not an official Microsoft package.
To resolve this issue, I had to do the following:
- Launch the Visual Studio Installer with administrative privileges
- If it prompts you to install updates to Visual Studio, do so before continuing
- When prompted, click the button to Modify the existing installation
- Click on the "Individual components" tab / header along the top
- Scroll down to the "Debugging and testing" section
- Check the box next to "Web performance and load testing tools"
- Click the Modify button on the bottom right corner of the dialog to install the missing DLLs
Once the DLLs are installed, you can add references to them using the method that Agent007 indicated in his answer.
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;
I.e. for Visual Studio 2013 I would reference this assembly:
Microsoft.VisualStudio.Shell.14.0.dll
You can find it i.e. here:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\BugAid Software\BugAid\1.0
and don't forget to implement:
using Microsoft.VisualStudio;
If you came here because your VSTS build job is failing with the above error message. Ensure that you are using at least version 2.* of the nuget task to restore your packages.
프로젝트를 이동하고 패키지 폴더를 삭제 한 후이 문제가 발생했습니다. Nuget은 MSTest.TestAdapter 및 MSTest.TestFramework v 1.3.2가 설치되었음을 보여주었습니다. 수정은 VS를 관리자로 열고 빌드하는 것처럼 보였습니다. 그 후 관리자 권한이 없어도 다시 열고 빌드 할 수있었습니다.
'Microsoft.VisualStudio.QualityTools.UnitTestFramework "NuGet 패킷에 대한 참조를 추가하면 성공적으로 빌드됩니다.
이 URL을 참조하여 필요한 dll 파일을이 위치에서 다운로드하여 저장하십시오.
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies
URL은 https://github.com/NN---/vssdk2013/find/master
'development' 카테고리의 다른 글
Entity Framework 연결 문자열을 어떻게 편집해야합니까? (0) | 2020.07.24 |
---|---|
XMLHttpRequest에서 onload가 readyState == 4와 같습니까? (0) | 2020.07.24 |
C ++에서 변수를 캐시하거나 컴파일러가 최적화하도록해야합니까? (0) | 2020.07.24 |
Asp.net MVC ModelState.Clear (0) | 2020.07.24 |
Eclipse : log4j.xml에서 log4j.dtd 참조 (0) | 2020.07.24 |