WIX Multiple DefineConstants defined in MSBuild - problem with proposed solution
Regarding the answer provided at this link: Proposed solution
I tried to use this method in a several ways and I was unable to get it to work. I have double checked that I am running the framework 4 version of msbuild, which I am, and followed the instructions carefully.
My WixValues property looks like this
<PropertyGroup>
<WixValues>
OnBuildServer=True;
DefineConstants=TXT=$(TXT);ProdVersion=$(InstallVersion);
Configuration=Release;
Platform=x64;
SuppressAllWarnings=True;
APPDATA=$(APPDATA);
</WixValues>
</PropertyGroup>
But somehow the 2nd defineconstant value doesn't get to the command line even though all the other values get there OK.
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
The MSBuild task looks like this
<MSBuild
Projects="$(SvnWorkingCopy)\InstallSE64wix\InstallSE64wix.wixproj"
Targets="Rebuild"
Properties="$([MSBuild]::Unescape($(WixValues)))"
/>
Here's the project file entry
<DefineConstants>$([MSBuild]::Un开发者_如何学JAVAescape($(WixValues)))</DefineConstants>
Any help from Rory or anyone else who got this to work would be appreciated.
Thanks
I cannot take credit for this. Found the answer at wix users Thanks to Alex Ivanoff.
Here's the basic concept. 1st in the wixproj file add the following:
<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>
2nd in your msbuild task do this:
<MSBuild Projects="YourWixProject.wixproj"
Properties="BuildNumber=$(VerBuildNumber);RevisionNumber=$(RevisionNumber)"
/>
Note that the Properties aren't standard properties and normally they won't get passed through but in this case they will. Additional standard properties along with the non-standard ones also get transferred correctly.
精彩评论