2

With WIX Tools v3.10 I used to add a variable AddLocal to the bundle which I passed to the MsiProperty with the Name="ADDLOCAL" as described by BryanJ in "Pass parameters from bootstrapper to msi bundle package".

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

Now after switching to v3.11 I get this warning which will turn to an error in 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.

So what is the adequate way in v3.11 to pass an ADDLOCAL parameter from bootstrapper command line to the Msi?

Community
  • 1
  • 1
Heiko B.
  • 67
  • 1
  • 6
  • The change in WIX behavior was introduced in commit https://github.com/wixtoolset/wix3/commit/defd78e8a7e37a3b9b36cfaf6dec2af68344d202, which was work to fix this bug: https://github.com/wixtoolset/issues/issues/5294. – bradfordrg May 25 '17 at 11:39

4 Answers4

1

you can influence on ADDLOCAL parameter in your custom bootstrapper project something like that:

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

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

Stephen Lee Parker
  • 1,215
  • 9
  • 19
1

Rather than using AddLocal, I found adding code like:

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

to my msi file behaved in a reasonable manner, allowing me to add/remove a feature. Modified from: using https://support.firegiant.com/hc/en-us/articles/230912227-Control-feature-states-for-silent-install-

I like using the 'Variable=X' syntax because I find it easier to read. Without the FEATUREB_INSTALLED test I found uninstall did not act as I wanted.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Joe Dvorak
  • 11
  • 1
0

Well, you can always pass a value to a Variable from the Code behind like this.

Bootstrapper.Engine.StringVariables["AddLocal"] = "your value";
raja_89
  • 3
  • 5