将值从 TeamBuild 传递到 MSBuild
我有一个正在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我不是 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
这是通过 SolutionToBuild 标记中的属性元数据完成的。 例如:
This is done via the properties metadata in the SolutionToBuild tag. For example:
选项 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.