1

关于此链接提供的答案:Proposed solution

我尝试以多种方式使用此方法,但无法使其正常工作。我已经仔细检查过我正在运行我正在运行的框架 4 版本的 msbuild,并仔细按照说明进行操作。

我的 WixValues 属性看起来像这样

  <PropertyGroup>
    <WixValues>
      OnBuildServer=True;
      DefineConstants=TXT=$(TXT);ProdVersion=$(InstallVersion);
      Configuration=Release;
      Platform=x64;
      SuppressAllWarnings=True;
      APPDATA=$(APPDATA);
    </WixValues>
  </PropertyGroup>

但不知何故,第二个 defineconstant 值没有进入命令行,即使所有其他值都可以到达那里。

The candle command line from the msbuild log looks like this:
..\WixTools\candle.exe -sw -TXT=TRUE -d"DevEnvDir=*Undefined if not building from within Visual Studio*" -d"SolutionDir=*Undefined if not building a solution or within Visual Studio*" -d"SolutionExt=*Undefined if not building a solution or within Visual Studio*" -d"SolutionFileName=*Undefined if not building a solution or within Visual Studio*" -d"SolutionName=*Undefined if not building a solution or within Visual Studio*" -d"SolutionPath=*Undefined if not building a solution or within Visual Studio*" -dConfiguration=Release -dOutDir=bin\x64\Release\ -dPlatform=x64 -dProjectDir=C:\Builds\Viper06\InstallSE64wix\ -dProjectExt=.wixproj -dProjectFileName=InstallSE64wix.wixproj -dProjectName=InstallSE64wix -dProjectPath=C:\Builds\Viper06\InstallSE64wix\InstallSE64wix.wixproj -dTargetDir=C:\Builds\Viper06\InstallSE64wix\bin\x64\Release\ -dTargetExt=.msi -dTargetFileName=InstallSE64wix.msi -dTargetName=InstallSE64wix -dTargetPath=C:\Builds\Viper06\InstallSE64wix\bin\x64\Release\InstallSE64wix.msi -out obj

MSBuild 任务如下所示

<MSBuild
      Projects="$(SvnWorkingCopy)\InstallSE64wix\InstallSE64wix.wixproj"
      Targets="Rebuild"
      Properties="$([MSBuild]::Unescape($(WixValues)))"
      />

这是项目文件条目

<DefineConstants>$([MSBuild]::Unescape($(WixValues)))</DefineConstants>

来自 Rory 或其他任何人的帮助将不胜感激。

谢谢

4

1 回答 1

6

我不能把这归功于。在wix users找到答案 感谢 Alex Ivanoff。

这是基本概念。第一个在 wixproj 文件中添加以下内容:

<Target Name="BeforeBuild">
    <CreateProperty Condition="$(BuildNumber) != ''"
Value="BuildNumber=$(BuildNumber);$(DefineConstants)">
      <Output TaskParameter="Value" PropertyName="DefineConstants" />
    </CreateProperty>
    <CreateProperty Condition="$(RevisionNumber) != ''"
Value="RevisionNumber =$(RevisionNumber);$(DefineConstants)">
      <Output TaskParameter="Value" PropertyName="DefineConstants" />
    </CreateProperty>
  </Target>

在您的 msbuild 任务中执行以下操作:

<MSBuild Projects="YourWixProject.wixproj" 
   Properties="BuildNumber=$(VerBuildNumber);RevisionNumber=$(RevisionNumber)" 
/>

请注意,属性不是标准属性,通常它们不会通过,但在这种情况下它们会。其他标准属性以及非标准属性也可以正确传输。

于 2011-04-01T21:04:59.073 回答