我正从我的MSBuild脚本运行单元测试(MSTest):
<Target Name="AfterBuild">
<ItemGroup>
<TestAssemblies Include="$(MSBuildProjectDirectory)\ContinuousDeploymentProof.Web.Tests\bin\$(Configuration)\ContinuousDeploymentProof.Web.Tests.dll"/>
</ItemGroup>
<PropertyGroup>
<MsTestCommand>"$(MsTestExePath)" @(TestAssemblies->'/testcontainer:"%(FullPath)"', ' ') /resultsfile:"TestResults\Results.trx""</MsTestCommand>
</PropertyGroup>
<Message Text="MsTestCommand: @(TestAssemblies->'/testcontainer:$(DoubleQuotes)%(FullPath)$(DoubleQuotes)', ' ')" Importance="high"/>
<RemoveDir Directories="TestResults" Condition="Exists('TestResults')" />
<MakeDir Directories="TestResults" />
<Exec Command="$(MsTestCommand)" ContinueOnError="true" />
</Target>
测试运行但我也遇到两个奇怪的错误:
1
EXEC : warning : Test Run deployment issue: The assembly or module 'System.Web.
Mvc' directly or indirectly referenced by the test container 'c:\projects\conti
nuousdeploymentproof\development\continuousdeploymentproof.web.tests\bin\debug\
continuousdeploymentproof.web.tests.dll' was not found. [C:\Projects\Continuous
DeploymentProof\Development\ContinuousDeploymentProof.msbuild]
我怀疑这是因为Mvc是一个NuGet包,但不确定。 DLL确实存在于与测试dll相同的位置
2
EXEC : warning : Test Run deployment issue: The assembly or module 'log4net' di
rectly or indirectly referenced by the test container 'c:\projects\continuousde
ploymentproof\development\continuousdeploymentproof.web.tests\bin\debug\continu
ousdeploymentproof.web.tests.dll' was not found. [C:\Projects\ContinuousDeploym
entProof\Development\ContinuousDeploymentProof.msbuild]
这个非常奇怪,因为我从不直接调用log4net。我相信它在默认的Mvc termplate中的某些OAuth引用中使用。我是否需要在MSBuild脚本中直接引用它们?