尝试使用“获取”任务时,MSBuild构建失败

时间:2013-04-02 16:26:33

标签: tfs msbuild build-automation tfs2012

我正在进行从TFS2010到TFS2012的测试升级。他们使用升级模板运行一组广泛的自定义MSBuild任务来自动化他们的构建和部署。 MSBuild项目最初是为TFS2005创建的,并且在某些时候直接升级到TFS2010。他们正在构建的解决方案主要针对.NET 2.0,他们仍在使用VS2005进行大多数开发。

到目前为止,我已经安装了VS2005,VS2010和TFS2012以及Update 1(按此顺序),并将他们的TFS2010数据库升级到TFS2012。构建控制器与应用程序层和数据库位于同一台机器上,只是因为这是一个“概念证明”升级,用于识别在实际升级之前需要使用构建过程解决的任何问题。

当我运行任何基于MSBuild的构建时,我收到以下错误:

  

C:\ Builds \ 18 \ Web \ ES-INTEGRATION-WebTest \ BuildType \ TFSBuild.proj(75):   类型的扩展   'Microsoft.TeamFoundation.Build.Client.IBuildDetail'必须是   已配置以运行此工作流程。   C:\ Builds \ 18 \ Web \ ES-INTEGRATION-WebTest \ BuildType \ TFSBuild.proj(75):   “获取”任务意外失败。

     

System.Activities.ValidationException:类型的扩展名   'Microsoft.TeamFoundation.Build.Client.IBuildDetail'必须是   已配置以运行此工作流程。

     

在   System.Activities.Hosting.WorkflowInstanceExtensionCollection..ctor(活动   workflowDefinition,WorkflowInstanceExtensionManager extensionManager)

     

在   System.Activities.Hosting.WorkflowInstanceExtensionManager.CreateInstanceExtensions(活动   workflowDefinition,WorkflowInstanceExtensionManager extensionManager)

     

在   System.Activities.Hosting.WorkflowInstance.RegisterExtensionManager(WorkflowInstanceExtensionManager   extensionManager)

     

在System.Activities.WorkflowApplication.EnsureInitialized()

     

在   System.Activities.WorkflowApplication.RunInstance(WorkflowApplication   实例)

     

在System.Activities.WorkflowApplication.Invoke(活动活动,   IDictionary`2输入,WorkflowInstanceExtensionManager扩展,   TimeSpan超时)

     

在System.Activities.WorkflowInvoker.Invoke(活动工作流程,   IDictionary`2输入,TimeSpan超时,   WorkflowInstanceExtensionManager扩展)

     

在   Microsoft.TeamFoundation.Build.Tasks.WorkflowTask.ExecuteInternal()

     

at Microsoft.TeamFoundation.Build.Tasks.Task.Execute()

     

在   Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()

     

在   Microsoft.Build.BackEnd.TaskBuilder.d__20.MoveNext()

我已经完成并将构建削减到一个非常小的案例,重现了这个问题。完整的.proj文件如下:

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="DesktopBuild" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">

    <!-- Do not edit this -->
    <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\TeamBuild\Microsoft.TeamFoundation.Build.targets" />
    <ProjectExtensions>
        <!--  DESCRIPTION
     The description is associated with a build type. Edit the value for making changes.
    -->
        <Description>Builds and Deploys the BE site to the integration environment</Description>
        <!--  BUILD MACHINE
     Name of the machine which will be used to build the solutions selected.
    -->
        <BuildMachine>[redacted]</BuildMachine>
    </ProjectExtensions>
    <PropertyGroup>
        <!--  TEAM PROJECT
     The team project which will be built using this build type.
    -->
        <TeamProject>Web</TeamProject>
        <!--  BUILD DIRECTORY
     The directory on the build machine that will be used to build the
     selected solutions. The directory must be a local path on the build
     machine (e.g. c:\build).
    -->
        <BuildDirectoryPath>c:\build</BuildDirectoryPath>
        <!--  DROP LOCATION
      The location to drop (copy) the built binaries and the log files after
     the build is complete. This location has to be a valid UNC path of the
     form \\Server\Share. The build machine service account and application
     tier account need to have read write permission on this share.
    -->
        <DropLocation>\\[redacted]\BuildDrop</DropLocation>
        <!--  TESTING
     Set this flag to enable/disable running tests as a post build step.
    -->
        <RunTest>True</RunTest>
        <!--  WorkItemFieldValues
      Add/edit key value pairs to set values for fields in the work item created
      during the build process. Please make sure the field names are valid 
      for the work item type being used.
    -->
        <WorkItemFieldValues>Symptom=build break;Steps To Reproduce=Start the build using Team Build</WorkItemFieldValues>
        <!--  CODE ANALYSIS
       To change CodeAnalysis behavior edit this value. Valid values for this
       can be Default,Always or Never.

     Default - To perform code analysis as per the individual project settings
     Always  - To always perform code analysis irrespective of project settings
     Never   - To never perform code analysis irrespective of project settings
     -->
        <RunCodeAnalysis>Default</RunCodeAnalysis>
        <!--  UPDATE ASSOCIATED WORK ITEMS
     Set this flag to enable/disable updating associated workitems on a successful build
    -->
        <UpdateAssociatedWorkItems>false</UpdateAssociatedWorkItems>
        <!-- Title for the work item created on build failure -->
        <WorkItemTitle>Build failure in build:</WorkItemTitle>
        <!-- Description for the work item created on build failure -->
        <DescriptionText>This work item was created by Team Build on a build failure.</DescriptionText>
        <!-- Text pointing to log file location on build failure -->
        <BuildlogText>The build log file is at:</BuildlogText>
        <!-- Text pointing to error/warnings file location on build failure -->
        <ErrorWarningLogText>The errors/warnings log file is at:</ErrorWarningLogText>
    </PropertyGroup>



    <PropertyGroup>
        <SourceBranchPath>Main</SourceBranchPath>
    </PropertyGroup>

  <!-- Does some basic validation of the environment before the build starts -->
  <Target Name="PreBuildValidations" >
    <Get FileSpec="$/Web/$(SourceBranchPath)/BuildFiles/Tools/PSExec.exe" Workspace="$(WorkspaceName)" Recursive="false" Force="true" TeamFoundationServerUrl="$(TeamFoundationServerUrl)"/>
  </Target>

    <Target Name="BeforeGet">
        <CallTarget Targets="PreBuildValidations" />
    </Target>


</Project>

2 个答案:

答案 0 :(得分:1)

我明白了。显然,BuildUri任务需要Get参数。我添加了BuildUri="$(BuildURI)",一切都很顺利。

答案 1 :(得分:-1)

您的构建在msbuild脚本中的“Get Task”上失败。您只下拉了一个文件,它是BeforeGet目标中的.exe文件。为了构建项目,您需要一个项目文件。

看起来错误可能是因为您在Get任务中遗漏了参数或传入了无效参数。

为什么在构建只能从构建定义工作区中拉下文件时需要预建验证步骤?