如何将AddLocal-Parameter从wix标准引导程序传递给MsiPackage

时间:2017-05-11 14:11:00

标签: wix bootstrapper wix3.11

使用WIX工具v3.10,我曾经将变量AddLocal添加到我使用MsiProperty传递给Name="ADDLOCAL"的包<Bundle> ... <Variable Name="InstallLevel" Type="numeric" bal:Overridable="yes" Value="1"/> <Variable Name="AddLocal" Type="string" bal:Overridable="yes" Value=""/> <Chain> <MsiPackage Id="Addin64bit_loc" Vital="yes" DisplayInternalUI="yes" ... EnableFeatureSelection="yes" > ... <MsiProperty Name="INSTALLLEVEL" Value="[InstallLevel]"/> <MsiProperty Name="ADDLOCAL" Value="[AddLocal]"/> </MsiPackage> </Chain> </Bundle>

Warning CNDL1149: The 'ADDLOCAL' MsiProperty is controlled by the bootstrapper and cannot be authored. 
(Illegal properties are: 'ACTION', 'ADDLOCAL', 'ADDSOURCE', 'ADDDEFAULT', 'ADVERTISE', 'ALLUSERS', 'REBOOT', 'REINSTALL', 'REINSTALLMODE', or 'REMOVE'.) 
Remove the MsiProperty element. 
This restriction will be enforced as an error in WiX v4.0.

现在切换到v3.11后,我收到此警告,在v4中会出现错误:

STRING_TO_BE_SEARCHED = "SOME_STRING_IN_FILE_A"

那么在v3.11中将ADDLOCAL参数从bootstrapper命令行传递给Msi的适当方法是什么?

3 个答案:

答案 0 :(得分:1)

我遇到了同样的问题,最后只使用了ADDLOCAL属性集的转换。

答案 1 :(得分:0)

您可以在自定义引导程序项目中影响ADDLOCAL参数:

_bootstrapper.PlanMsiFeature += (_, ea) =>
{
    ea.State = (needToInstall) ? FeatureState.Local : FeatureState.Absent;
};

答案 2 :(得分:0)

好吧,你总是可以将代码后面的代码传递给一个变量。

Bootstrapper.Engine.StringVariables["AddLocal"] = "your value";