Visual studio 我们怎样才能显示一个";“步骤”;VisualStudio内部构建过程?
当您从VisualStudio(2008或2005)监视TFS构建时,您可以看到它在哪里运行 问题是,我有一些构建后自定义步骤,我希望开发人员能够直接通过UI看到。这些步骤需要一些时间,我们还可以获得构建步骤的“时间”Visual studio 我们怎样才能显示一个";“步骤”;VisualStudio内部构建过程?,visual-studio,tfs,build-process,build-automation,Visual Studio,Tfs,Build Process,Build Automation,当您从VisualStudio(2008或2005)监视TFS构建时,您可以看到它在哪里运行 问题是,我有一些构建后自定义步骤,我希望开发人员能够直接通过UI看到。这些步骤需要一些时间,我们还可以获得构建步骤的“时间” 知道如何显示它吗?这是我在TFS 2008中向构建报告添加步骤时通常使用的模式。(有关我在团队构建会谈中通常使用的完整示例,请参见) 基本上,神奇之处在于TFS2008中为您提供了一个名为“BuildStep”的自定义任务。以下是我在报告中生成和安装MSI安装程序并构建相应构建步
知道如何显示它吗?这是我在TFS 2008中向构建报告添加步骤时通常使用的模式。(有关我在团队构建会谈中通常使用的完整示例,请参见) 基本上,神奇之处在于TFS2008中为您提供了一个名为“BuildStep”的自定义任务。以下是我在报告中生成和安装MSI安装程序并构建相应构建步骤的部分:
<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.请注意,在@Martin Woodward的伟大示例中,PackageBinaries是现有的。如果要使用自己的目标,可以使用任务从已知目标之一调用它们,例如
<Target Name="AfterDropBuild">
<CallTarget Targets="CreateDelivery"/>
<CallTarget Targets="CreateInventory"/>
</Target>
然后在您的目标(例如CreateDelivery)中,按照Martin的示例使用BuildStep任务