18

请告诉我如何使用 msbuild 运行 nunit。我正在使用 TFS 进行代码集成和 VS2010 。

4

1 回答 1

19

由于您使用的是 Team Foundation Server,因此您可能希望将 NUnit 与 TFSBuild 而不是 MSBuild 集成。

您将需要 MSBuild 任务才能运行 NUnit,如以下三个教程中所述:

简单的方法是使用MSBuild 社区任务,您已经NUnit准备好可以使用的任务,您只需将目标添加到您的 msbuild 文件,如下所示:

<Target Name="RunTests">  
    <!-- Run Unit tests -->  
    <CreateItem Include="$(OutDir)*.Tests.dll">  
      <Output TaskParameter="Include" ItemName="TestAssembly" />  
    </CreateItem>  
    <NUnit ToolPath="..\Tools\NUnit" DisableShadowCopy="true" Assemblies="@(TestAssembly)" />  
  </Target>
于 2011-01-05T14:54:44.653 回答