2011-04-01 159 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)" 
/> 

注意,属性不是标准的特性,通常他们不会得到穿过但在这种情况下,他们会。其他标准属性和非标准属性也会正确传输。

相关问题