我具有在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被内置显示该$(版)是空白的获取打印每次消息。

有什么方法,我可以拿到项目文件中看到的TFSBuild.proj属性?

Vaccano

有帮助吗?

解决方案 2

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

其他提示

我不是在维克斯的专家,但我发现这一点,以为你可以试试看。

中的MSBuild 设置属性为维克斯

选项1

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

选项2

抽象出来的WiX的打造出自身的selft包含脚本,然后使用的MSBuild来直接调用并通过所有必要的属性。我有充分执行的 http://blog.newagesolution.net/2008/06/how-to-use-msbuild-and-wix-to-msi.html ,可能是你的兴趣。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top