1

我对 TeamCity 很陌生。我发现一些 xml 的伎俩就像

<Gallio IgnoreFailures="true" ...

但我不知道把这个放在哪里。如何调用这个。在 TeamCity 中添加哪些步骤。对于任何教程,我都会非常感激。

4

1 回答 1

2

1 向您的解决方案添加一个库项目。
2 编辑一个项目(在下面添加部分)并提交。

<!-- put this in csproj almost at the end in target section -->
<UsingTask AssemblyFile="Gallio directory - wherever it is insalled\bin\Gallio.MSBuildTasks.dll" TaskName="Gallio" />

<ItemGroup>
    <TestAssemblies Include="Path to your test project dll (ex ..\testProjName\bin\Debug\testProjName.dll" />
    <!-- put as many TestAssemblies as you want -->
</ItemGroup>

<!-- name of the target is important to rememver. You will use it in Team City Configuration -->
<Target Name="RunTests"> 
    <Gallio Files="@(TestAssemblies)" IgnoreFailures="false" ReportTypes="html" ShowReports="true">
    <!-- This tells MSBuild to store the output value of the task's ExitCode property
         into the project's ExitCode property -->
        <Output TaskParameter="ExitCode" PropertyName="ExitCode" />
    </Gallio>
    <Error Text="Tests execution failed" Condition="'$(ExitCode)' != 0" />
</Target>

3 添加一个 MSBuild 步骤来构建配置。a) Runner Type:MSBuild b) Build File Path:测试项目的相对路径。c) 目标:在上面的示例中,目标名称是“RunTests” d) 相应地填写所有其他字段。e) 保存步骤

您应该已经能够运行和测试您的项目。如果您认为可以在此处添加其他步骤,请编辑我的答案。

一段时间以来,我一直在寻找答案,并在几个网站上部分找到了答案,但整体上却没有。例如:其他类似的答案不仅是部分的,而且具有在 MsBuild 3.2 中不起作用的参数。

于 2013-09-11T13:13:34.337 回答