ठीक है। परिनियोजन इटिम इसे ठीक करने का एक तरीका है। हालांकि, परिनियोजन इटैम थोड़ा नाजुक है।
यहां बताया गया है कि मैंने इसे कैसे ठीक किया।
"वर्तमान निर्देशिका" को परिनियोजन इटैम के साथ लाइन करना है। मैंने पाया सबसे अच्छा समझौता वर्तमान निर्देशिका को सेट करना होगा जहां .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 घरों फ़ोल्डर में एक सीडी (परिवर्तन निर्देशिका) करना है।
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 रिश्तेदार पथ सही ढंग से काम करता है।
जिमीनी क्रिकेट ....... वह थोड़ा सा पागल है।
ध्यान दें, पॉल टेलर यहाँ का जवाब
Running MsTest from the command line with a custom assembly base directory
मेरे लिए काम नहीं किया।
ओह धन्यवाद, मेरी समस्या का समाधान – aeruL