【问题标题】:team build target not executed团队建设目标未执行
【发布时间】:2011-09-21 16:46:11
【问题描述】:

我有一个 tfs 2008 版本,需要添加 WiX 编译。

当前构建执行并编译并将所有输出复制到以下目标中的放置位置

<Target Name="AfterCompile"> .... </Target>

我在它的正下方添加了另一个目标,如下所示

<UsingTask TaskName="HeatDirectory" AssemblyFile="$(WixTasksPath)" />

<Target Name="BuildMsi" DependsOnTargets="AfterCompile">
  <Message Text="Start harvesting Website files for Wix compliation" />
  <HeatDirectory
                ToolPath="$(WixToolPath)"
                Directory="$(DropLocation)\Latest\x86\Release\_PublishedWebsites\IFMA.MasterPlan.Web"
                GenerateGuidsNow="yes"
                ComponentGroupName="Web"
                OutputFile="$(MSBuildProjectDirectory)\Setup\Product\Fragments\wwwfiles.wxs"
                SuppressFragments="yes"
                DirectoryRefId="WebRoot"
                KeepEmptyDirectories="yes"
                PreprocessorVariable="var.WebRoot"
                SuppressRegistry="yes"
                SuppressRootDirectory="yes"
                SuppressCom="yes"
                   />

  <Message Text="Finished harvesting Website files for Wix compliation" />

</Target>

BuildMsi 目标永远不会执行,但 AfterCompile 肯定会执行。

默认构建目标中未列出 BuildMsi 但我认为由于它依赖于 AfterCompile 它将在它之后执行。

我在这里错过了什么?

【问题讨论】:

  • 我不确定 heat 任务是否正确,但我实际上并不关心让目标执行然后我可以担心让 heat 任务工作
  • Daniel - 我添加了一些关于目标注入的信息,您可能可以在这种情况下使用这些信息。

标签: tfs msbuild tfsbuild


【解决方案1】:

DependsOnTargets 列出了在你的目标可以运行之前必须执行的目标,它不会强制你的目标在目标列表运行之后运行。

见:http://msdn.microsoft.com/en-us/library/t50z2hka(v=VS.90).aspx

如果您使用的是 MSBuild 4.0,则需要 AfterTargets 属性:

AfterTargets:可选属性。

分号分隔的目标列表 名字。指定时,表示 这个目标应该在 指定的目标或目标。这 让项目作者扩展一个 现有的一组目标没有 直接修改它们。

或者,您可以使用目标注入,这基本上是覆盖 .proj 文件中的 CompileDependsOn 属性以在最后包含您的目标。您需要在导入公共目标文件后声明该属性,以确保它是该属性的最后定义。

<PropertyGroup>
    <CompileDependsOn>
        $(CompileDependsOn);
        MyCustomTarget
    </CompileDependsOn>
</PropertyGroup>

更多详情请见"How to extend the visual studio build process"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-05-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多