我正在尝试运行 MSTest.exe,但似乎未正确读取 testcontainer;而我的测试在 Visual Studio 中的所有配置环境中都成功运行。
我使用的命令是:
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe" /nologo /usestderr /testSettings:"C:\temp\MyProject\Sources\MyProject\Local.testsettings" /searchpathroot:"C:\temp\MyProject\Binaries" /resultsfileroot:"C:\temp\MyProject\TestResults" /testcontainer:"C:\temp\MyProject\Binaries\MyProject.Services.Server.UnitTests.dll"
testcontainer 项目中的项目引用如下所示:
<ItemGroup>
<ProjectReference Include="..\..\Services\MyProject.Services.Server\MyProject.Services.Server.csproj">
<Project>{92EC1999-CC0C-47DD-A4D6-17C3B1233C50}</Project>
<Name>MyProject.Services.Server</Name>
</ProjectReference>
<ProjectReference Include="..\..\SvcConfiguration\MyProject.ServiceConfiguration.Interfaces\MyProject.ServiceConfiguration.Interfaces.csproj">
<Project>{8E2E7BA9-75DB-458E-A184-AC1030EAD581}</Project>
<Name>MyProject.ServiceConfiguration.Interfaces</Name>
</ProjectReference>
<ProjectReference Include="..\..\SvcConfiguration\MyProject.ServiceConfiguration.Services\MyProject.ServiceConfiguration.Services.csproj">
<Project>{39514766-23A8-45DB-96EA-B6B4D9C8B086}</Project>
<Name>MyProject.ServiceConfiguration.Services</Name>
</ProjectReference>
</ItemGroup>
ServiceConfiguration.Interfaces 和 ServiceConfiguration.Services DLL 都不会放入 TestResults 中的 Out 文件夹中。
项目 GUID 在引用和引用的项目之间确实匹配。
命令行中是否缺少某些内容?
最佳答案
mstest.exe 不会复制所有引用的 dll。
请参阅有关此内容的博客文章 https://web.archive.org/web/20111221110459/http://www.dotnetthoughts.net/2011/11/22/mstest-exe-does-not-deploy-all-items/
关于command-line - MSTest.exe 没有复制所有需要的项目 DLL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8083491/