问题
i am trying to execute our tests via cmdline. I use VS2012, but i always get this error:
When i run the tests directly in VS2010 on the same machine they run fine. I can't use VS2010 for cmdline because we have the wrong license ( assembly finding doesn't work ) so i have to use 2012. All Windows updates are present.
Has somebody had similar issues with MSTest/VS2012 ?
回答1:
If you want to keep VS 2012 update 2, 3, or 4 installed, you can try the below workaround:
Run the below commands in the command line:
DEL /S %windir%\*Microsoft.VisualStudio.QualityTools.Tips.UnitTest.AssemblyResolver.ni.dll*
DEL /S %windir%\*Microsoft.VisualStudio.QualityTools.ExecutionCommon.ni.dll*
This is a workaround provided by Microsoft guys.
You need run this batch again after you install Visual Studio updates or sometime even Windows Updates.
回答2:
I followed Yanhua's Microsoft article link and found a workaround that I liked better than deleting random files:
Use vstest.console.exe instead of mstest.exe.
Note, the arguments for vstest.console.exe are different. It wants a space-separated list of test.dll's
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" "TestProject1.dll"
Here is my msbuild setup that does the same thing:
<PropertyGroup>
<MSTEST>"$(VS110COMNTOOLS)..\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe"</MSTEST>
</PropertyGroup>
...
<Target Name="MyTests" >
<ItemGroup>
<!-- These Items should be evaluated at Target runtime -->
<TestFiles Include="..\Tests\**\bin\$(Configuration)\*.Test.dll" />
</ItemGroup>
<!-- Run Tests -->
<PropertyGroup>
<!--TestSuccessOrNot is the property specify whether the Test is sucess or not -->
<TestSuccessOrNot>1</TestSuccessOrNot>
</PropertyGroup>
<Exec Command="$(MSTEST) @(TestFiles, ' ')" >
<Output TaskParameter="ExitCode" PropertyName="TestSuccessOrNot"/>
</Exec>
<Error Text="Tests Failed" Condition="$(TestSuccessOrNot) == '1'" />
</Target>
回答3:
I have had the same problem. I just removed update 2 of Visual Studio 2012. Steps:
- Remove update 2 of Visual studio 2012 (via View installed updates)
- Restart system
- Change installation of Visual Studio 2012 (via Uninstall or change a program->change->Fix)
- Restart system
来源:https://stackoverflow.com/questions/17500124/mstest-exe-vs2012-crashes-qtagent32-exe