2011-04-01 153 views
1

關於該鏈接提供了答案的問題:Proposed solution中的MSBuild定義WIX多DefineConstants - 與提出的解決方案

我試過多種方法可以使用這種方法,我無法得到它的工作。我仔細檢查了我正在運行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> 

任何幫助從羅裏或別人誰得到了這個工作,將不勝感激。

感謝

回答

6

我不能居功這一點。找到答案wix users 感謝Alex Ivanoff。

以下是基本概念。 月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)" 
/> 

注意,屬性不是標準的特性,通常他們不會得到穿過但在這種情況下,他們會。其他標準屬性和非標準屬性也會正確傳輸。

相關問題