【问题标题】:WIX Multiple DefineConstants defined in MSBuild - problem with proposed solutionMSBuild 中定义的 WIX Multiple DefineConstants - 建议解决方案的问题
【发布时间】:2011-04-01 16:01:57
【问题描述】:

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

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

我的 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 或其他任何帮助它工作的人,我们将不胜感激。

谢谢

【问题讨论】:

    标签: msbuild wix wix3.5 msbuild-4.0


    【解决方案1】:

    我不能对此表示赞赏。在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)" 
    />
    

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-14
      • 1970-01-01
      相关资源
      最近更新 更多