2011-03-30 2 views
9

어셈블리를 찾을 수없는 내가 명령 MSTEST /testsettings:local.Testsetting /testcontainer:folder\obj\Debug\test.dllMSTEST 제가 <p>MSTEST</p> 사용 하였다

이 출력이다

를 사용 경고 : 테스트 실행 배치 문제 : 어셈블리 또는 모듈 'Microsoft.Practices

실행 다음 문제 (들)을 가지고있다. Prism ' 직접 또는 테스트에 의해 간접적으로 참조 된 컨테이너'test.dll '을 (를) 찾을 수 없습니다. 경고 : 테스트 실행 배포 문제 : 'Project.Common.dll'어셈블리 또는 모듈 컨테이너 'test.dll'에서 직접 참조하거나 을 간접적으로 참조했습니다. 경고 : 테스트 실행 배포 문제 : 'Project.Infrastructure.dll'어셈블리 또는 모듈 직접 또는 테스트 컨테이너 'test.dll'에 의해 간접적으로 참조되는 어셈블리 또는 모듈을 찾을 수 없습니다. 경고 : 테스트 실행 배포 문제 : 어셈블리 또는 모듈 'Microsoft.Practices. Prism ' 직접 또는 테스트에 의해 간접적으로 참조 된 컨테이너'test.dll '을 (를) 찾을 수 없습니다.

MSTest를 잘 실행할 수 있도록 할 수있는 방법은 무엇입니까?

답변

4

빌드 서버의 GAC에 프리즘 파일을 설치할 수 있습니다.

+0

감사합니다. 내 문제를 해결합니다. – aeruL

2

테스트에서 직접 사용되지 않는 모든 어셈블리는 테스트 폴더에 복사되지 않습니다. 를 GAC에 어셈블리를 추가하지 않고

[DeploymentItem("Microsoft.Practices.Prism.dll")] 

이 문제가 해결 : 그 때문에, 그 시험 방법은 같은 속성으로 장식한다.

+2

비슷한 오류가 발생하며 프로젝트가 Jenkins에서 진행 중입니다. Jenkins에서 솔루션을 사용하는 방법? 경고 : 테스트 실행 배포 문제 : 테스트 컨테이너 'd : \ alm_jenprodslave_1 \ workspace \ total fund \ alm \ otpp.pivot.core \ otpp.pivot.core.model에 의해 직접 또는 간접적으로 참조되는 어셈블리 또는 모듈'zlib.net ' .test \ bin \ debug \ otpp.pivot.core.model.test.dll '파일을 찾을 수 없습니다. –

+0

어셈블리가 GAC에 없을 때이 접근법 (이름 만 사용)이 올바르게 작동합니까? 문제가 발생하여 전체 파일 경로를 대신 입력해야합니다. – Dib

0

확인. DeploymentItem은이를 해결하는 방법입니다. 그러나 DeploymentItem은 약간 깨지기 쉽습니다.

다음은 어떻게 수정 했습니까?

"현재 디렉터리"는 DeploymentItem과 일치해야합니다. 내가 찾은 최고의 절충점은 현재 디렉토리를 .sln 파일의 위치로 설정하는 것입니다.

내 폴더 구조는 다음과 같습니다.

C:\SomeRootFolder\ 
C:\SomeRootFolder\MySolution.sln 
C:\SomeRootFolder\packages\ 
C:\SomeRootFolder\packages\MyNugetPackage.1.2.3.4\lib\net45\SomeThirdPartyDll.dll 
C:\SomeRootFolder\MyTestProject\MyTestProject.csproj 
C:\SomeRootFolder\MyTestProject\MyTestClass.cs 

MyTestClass.cs

[TestClass] 
public class MyTestClass 
{ 
    [TestMethod] 
    /* The DeploymentItem item below is for error ::: Warning: Test Run deployment issue: The assembly or module 'SomeDll' directly or indirectly referenced by the test container 'C:\SomeRootFolder\MyTestProject\bin\debug\MyTestProject.dll' was not found. */ 
    /* There must be a CD (to the .sln folder) command... before the MsTest.exe command is executed */ 
    [DeploymentItem(@".\packages\MyNugetPackage.1.2.3.4\lib\net45\SomeDll.dll")] 
    public void MyTest() 
    { 
    } 
} 

은 "트릭"

은의 .sln 주택 폴더로 CD (디렉토리 변경)을하는 것입니다. "현재 디렉토리"(CD의 결과)에 있기 때문에

REM Now the normal restore,build lines 
nuget.exe restore "C:\SomeRootFolder\MySolution.sln" 
REM the above nuget restore would create "C:\SomeRootFolder\packages\MyNugetPackage.1.2.3.4\lib\net45\SomeThirdPartyDll.dll" 
MSBuild.exe "C:\SomeRootFolder\MySolution.sln" /p:Configuration=Debug;FavoriteFood=Popeyes /l:FileLogger,Microsoft.Build.Engine;logfile=MySolution.Debug.Build.log 
REM (the below line is the trick to line up the 'current folder' with the relative path of the DeploymentItem) 
cd "C:\SomeRootFolder\" 
REM now the below will work without the annoying message, note that C:\SomeRootFolder\MyTestProject\bin\Debug\SomeThirdPartyDll.dll exists 
MsTest.exe /testcontainer:"C:\SomeRootFolder\MyTestProject\bin\Debug\MyTestProject.dll" /resultsfile:MyTestProject.Dll.Results.trx 

지금 "C : \ SomeRootFolder \"는 DeploymentItem 상대 경로가 제대로 작동합니다.

Jimminy Crickets ....... 그건 좀 괴롭다.

주, 폴 테일러는

Running MsTest from the command line with a custom assembly base directory

나를 위해 작동하지 않았다 여기에 답합니다.

0

가장 쉬운 방법입니다. 그냥 새로 추가 된 코드에 중단 점을 추가 (테스트 방법의 시작 지점에서) 코드에

string value = AppDomain.CurrentDomain.BaseDirectory; 

를 추가하고 value 변수의 경로가 무엇인지 확인합니다.

테스트 프로세스를 계속하고 모든 것이 성공하면 values 변수의 폴더로 이동하십시오.

폴더 안에 모든 dll이 표시 될 수 있습니다. mstest 명령 줄 도구를 사용하여 프로젝트 dll을 원하는대로 복사하고 실행하십시오.

set mstestPath="C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE" 

%mstestpath%\mstest /testcontainer:CodedUITestProject1.dll