WIX Multiple DefineConstants, определенных в MSBuild - проблема с предлагаемым решением

Что касается ответа, предоставленного по этой ссылке: Предлагаемое решение

Я пытался использовать этот метод несколькими способами, но мне не удалось заставить его работать. Я дважды проверил, что я использую версию msbuild для framework 4, каковым я являюсь, и внимательно следил за инструкциями.

Мое свойство WixValues ​​выглядит так

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

Но почему-то 2-е значение 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>

Любая помощь от Рори или кого-либо еще, кто заставил это работать, будет оценена.

Спасибо


person mooncaptain    schedule 01.04.2011    source источник


Ответы (1)


Я не могу поверить в это. Нашел ответ на пользователям wix Спасибо Алексу Иванов.

Вот основная концепция. 1-й в файле 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>

2-й в вашей задаче msbuild сделайте это:

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

Обратите внимание, что Свойства не являются стандартными свойствами, и обычно они не передаются, но в этом случае они будут. Дополнительные стандартные свойства наряду с нестандартными также передаются корректно.

person mooncaptain    schedule 01.04.2011