当你从Visual Studio(2008或2005)监视TFS构建时,你可以看到它进行到哪一步了。
问题在于,我有一些后期构建自定义步骤,我希望开发人员能够直接通过UI查看。这些步骤需要一些时间,我们也可以获得构建步骤的“时间”。
有什么想法可以显示它吗?
当你从Visual Studio(2008或2005)监视TFS构建时,你可以看到它进行到哪一步了。
问题在于,我有一些后期构建自定义步骤,我希望开发人员能够直接通过UI查看。这些步骤需要一些时间,我们也可以获得构建步骤的“时间”。
有什么想法可以显示它吗?
<Target Name="PackageBinaries">
<!-- create the build step -->
<BuildStep TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
BuildUri="$(BuildUri)"
Message="Creating Installer"
Condition=" '$(IsDesktopBuild)' != 'true' " >
<Output TaskParameter="Id"
PropertyName="InstallerStepId" />
</BuildStep>
<!-- Create the MSI file using WiX -->
<MSBuild Projects="$(SolutionRoot)\SetupProject\wallboard.wixproj"
Properties="BinariesSource=$(OutDir);PublishDir=$(BinariesRoot);Configuration=%(ConfigurationToBuild.FlavourToBuild)" >
</MSBuild>
<!-- If we sucessfully built the installer, tell TFS -->
<BuildStep TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
BuildUri="$(BuildUri)"
Id="$(InstallerStepId)"
Status="Succeeded"
Condition=" '$(IsDesktopBuild)' != 'true' " />
<!-- Note that the condition above means that we do not talk to TFS when doing a Desktop Build -->
<!-- If we error during this step, then tell TFS we failed-->
<OnError ExecuteTargets="MarkInstallerFailed" />
</Target>
<Target Name="MarkInstallerFailed">
<!-- Called by the PackageBinaries method if creating the installer fails -->
<BuildStep TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
BuildUri="$(BuildUri)"
Id="$(InstallerStepId)"
Status="Failed"
Condition=" '$(IsDesktopBuild)' != 'true' " />
</Target>
首先,我创建了构建步骤,并将步骤的ID保存在名为InstallerStepId的属性中。完成任务后,我将该步骤的状态设置为“成功”。如果在执行步骤期间发生任何错误,则将该步骤的状态设置为“失败”。
祝好运,
Martin.
<Target Name="AfterDropBuild">
<CallTarget Targets="CreateDelivery"/>
<CallTarget Targets="CreateInventory"/>
</Target>
然后在您的目标(例如CreateDelivery)中,按照Martin的示例使用BuildStep任务。