将值从 TeamBuild 传递到 MSBuild

发布于 2024-07-19 09:16:52 字数 1313 浏览 5 评论 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 属性吗?

瓦卡诺

I have a build that is running in TFS TeamBuild. I want to pass a property from that to the MSBuild that is run for each Project built by the TFSBuild.proj.

Example:

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>

When the MyWixProjectFile.wixproj gets built the message showing that the $(Version) is blank gets printed every time.

Is there someway that I can get the project file to see the TFSBuild.proj properties?

Vaccano

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

玩心态 2024-07-26 09:16:52

我不是 Wix 专家,但我确实发现了这个,并认为你可以尝试一下。

在 MSBuild 中设置 WiX 的属性

Im not an expert in Wix but I did find this and thought you could give it a try.

Setting properties for WiX in MSBuild

背叛残局 2024-07-26 09:16:52

这是通过 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>

This is done via the properties metadata in the SolutionToBuild tag. For example:

  <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>
故笙诉离歌 2024-07-26 09:16:52

选项 1

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

选项 2

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

Option 1

Use MSBuild to directly call MyWIXProjectFile.wixproj and pass Version as property

Option 2

Abstract out build of wix out to its own selft contained script and then use MSBuild to call directly and passing all necessary properties. I have blog with full implementation doing this at http://blog.newagesolution.net/2008/06/how-to-use-msbuild-and-wix-to-msi.html that might be of interest to you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文