2

使用 WIX Tools v3.10,我曾经将一个变量添加AddLocal到我传递给 的包中,MsiPropertyName="ADDLOCAL"BryanJ在“将参数从引导程序传递到 msi 包包”中所述。

<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>

现在切换到 v3.11 后,我收到此警告,这将在 v4 中变成错误:

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 中将 ADDLOCAL 参数从引导程序命令行传递到 Msi 的适当方法是什么?

4

4 回答 4

1

I ran into the same issue and ended up using a transform with only the ADDLOCAL property set.

于 2017-08-01T12:27:29.730 回答
1

而不是使用 AddLocal,我发现添加如下代码:

<Feature Id="FeatureB" Level="0">
  <Condition Level="1">INSTALL_FEATUREB="1" OR FEATUREB_INSTALLED="1" 
  </Condition>
</Feature>

我的 msi 文件以合理的方式运行,允许我添加/删除一个功能。修改自:使用https://support.firegiant.com/hc/en-us/articles/230912227-Control-feature-states-for-silent-install-

我喜欢使用 'Variable=X' 语法,因为我发现它更容易阅读。如果没有 FEATUREB_INSTALLED 测试,我发现卸载没有按我的意愿运行。

于 2021-12-21T00:34:01.017 回答
0

您可以影响自定义引导程序项目中的 ADDLOCAL 参数,如下所示:

_bootstrapper.PlanMsiFeature += (_, ea) =>
{
    ea.State = (needToInstall) ? FeatureState.Local : FeatureState.Absent;
};
于 2017-05-25T09:09:28.237 回答
0

好吧,您总是可以像这样从后面的代码中将值传递给变量。

Bootstrapper.Engine.StringVariables["AddLocal"] = "your value";
于 2017-05-26T12:34:47.867 回答