我正在使用TFS 2008并使用内置的TeamBuild编写我的版本。我以这样的方式设置构建,它将在失败时创建Bug类型的工作项,并且还会在单元测试失败时创建错误。然而;今天我们的构建部分成功,因为exec任务启动了一个返回代码不为0的可执行文件。
我的问题;有没有办法确定构建的部分连续,并根据该检测创建一个错误工作项?
build .proj文件中的一个片段,我在其中根据失败的单元测试运行创建了一个错误:
<Target Name="AfterTest">
<!-- Refresh the build properties. -->
<GetBuildProperties TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
BuildUri="$(BuildUri)"
Condition=" '$(IsDesktopBuild)' != 'true' ">
<Output TaskParameter="TestSuccess" PropertyName="TestSuccess" />
</GetBuildProperties>
<!-- Set CompilationStatus to Failed if TestSuccess is false. -->
<SetBuildProperties TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
BuildUri="$(BuildUri)"
CompilationStatus="Failed"
Condition=" '$(IsDesktopBuild)' != 'true' and '$(TestSuccess)' != 'true' ">
</SetBuildProperties>
<CreateNewWorkItem BuildNumber="$(BuildNumber)"
BuildURi="$(BuildURI)"
Description="A failed test run caused the CreateNewWorkItem task created this bug. $(BuildlogText)"
TeamProject="$(TeamProject)"
TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
Title="Unit Test Failure in $(BuildNumber)"
WorkItemFieldValues="$(WorkItemFieldValues)"
WorkItemType="Bug"
Condition=" '$(IsDesktopBuild)' != 'true' and '$(TestSuccess)' != 'true' ">
</CreateNewWorkItem>
非常感谢任何帮助,谢谢!