0

我有一个在 TFS TeamBuild 中运行的构建。我想将一个属性传递给为 TFSBuild.proj 构建的每个项目运行的 MSBuild。

例子:

TFSBuild.proj

<PropertyGroup>
   <Version>0.0.0.0</Version>
</PropertyGroup>

<Target Name="BuildNumberOverrideTarget" 
        DependsOnTargets="AfterInitializeWorkspace">

  <!--Code that loads the version from a file (removed).-->

  <PropertyGroup>
    <!--Save off the version.-->
    <Version>$(TxCompleteVersion)</Version>
</PropertyGroup>

MyWIXProjectFile.wixproj

<Target Name="BeforeBuild">
<PropertyGroup>
  <!--If Version is defined then use that.  
   Else just use all zeros to show that this is a developer built version-->
  <CurrentVersion Condition="'$(Version)' == ''" >0.0.0.0</CurrentVersion>
  <CurrentVersion Condition="'$(Version)' != ''" >$(Version)</CurrentVersion>
</PropertyGroup>
<Message Condition="'$(Version)' == ''" 
         Text="Version info is empty (i.e. a developer build).  Version set to $(CurrentVersion)"/>

</Target>

当构建 MyWixProjectFile.wixproj 时,每次都会打印显示 $(Version) 为空白的消息。

有没有办法让我可以让项目文件看到 TFSBuild.proj 属性?

瓦卡诺

4

3 回答 3

0

我不是 Wix 专家,但我确实找到了这个,并认为你可以试一试。

在 MSBuild 中设置 WiX 的属性

于 2009-05-08T21:18:00.690 回答
0

这是通过 SolutionToBuild 标记中的属性元数据完成的。例如:

  <ItemGroup>
    <SolutionToBuild Include="$(BuildProjectFolderPath)\ChangeThisOne.sln">
      <Targets></Targets>
      <Properties>Change=True</Properties>
    </SolutionToBuild>
    <SolutionToBuild Include="$(BuildProjectFolderPath)\ChangeThisToo.sln">
      <Targets></Targets>
      <Properties>Change=True</Properties>
    </SolutionToBuild>
    <SolutionToBuild Include="$(BuildProjectFolderPath)\DontChangeThis.sln">
      <Targets></Targets>
      <Properties>Don'tChange=False</Properties>
    </SolutionToBuild>
  </ItemGroup>
于 2009-05-11T18:01:21.303 回答
0

选项1

使用 MSBuild 直接调用 MyWIXProjectFile.wixproj 并将 Version 作为属性传递

选项 2

将 wix 的构建抽象到它自己的 selft 包含的脚本中,然后使用 MSBuild 直接调用并传递所有必要的属性。我在http://blog.newagesolution.net/2008/06/how-to-use-msbuild-and-wix-to-msi.html有完整实现的博客,您可能会感兴趣。

于 2009-05-15T20:52:13.513 回答