Matt Williams
Matt Williams

Reputation: 1714

How to override the default MSIFASTINSTALL value in Wix?

I'm using the WixStandardBootstrapperApplication (WiX 3.11) to build a bundled installer. It's working great, but I need it to create a System Restore Point before the installation.

I believe that this is the default behaviour, but Wix provides a property in the Chain to disable this if required.

My chain is as follows:

<Chain>
  <MsiPackage SourceFile="Application1.msi" />
  <MsiPackage SourceFile="Application2.msi" />
</Chain>

When I run the executable and look in the log file, I can see that a system restore point was created:

[1E04:2828][2017-08-11T17:29:50]i360: Creating a system restore point.
[1E04:2828][2017-08-11T17:29:50]i361: Created a system restore point.

However when I open the System Restore UI on Windows I can't see a restore point.

When I look further down the log file, I see the arguments that the bootstrapper used when it called the .msi installer:

[1E04:2828][2017-08-11T17:29:53]i301: Applying execute package: Application1.msi, action: Install, path: C:\ProgramData\Package Cache\{28AD869E-998E-44D1-B83F-062D614B5EDC}v1.4.7\CApplication1.msi, arguments: ' ARPSYSTEMCOMPONENT="1" MSIFASTINSTALL="7"'

According to the MSIFASTINSTALL documentation, a value of 7 means that no system restore point will be created.

So I try to override this by setting the chain as follows:

<Chain>
  <MsiPackage SourceFile="Application1.msi" >
    <MsiProperty Name="MSIFASTINSTALL" Value="0"/>
  </MsiPackage>
  <MsiPackage SourceFile="Application1.msi">
    <MsiProperty Name="MSIFASTINSTALL" Value="0"/>
  </MsiPackage>
</Chain>

It seems that the property has been added, but not replaced:

[3354:3128][2017-08-11T16:22:43]i301: Applying execute package: CDV, action: Install, path: C:\ProgramData\Package Cache\{28AD869E-998E-44D1-B83F-062D614B5EDC}v1.4.7\ClinicalDataViewerSetup.msi, arguments: ' ARPSYSTEMCOMPONENT="1" MSIFASTINSTALL="7" MSIFASTINSTALL="0"'

There is still no system restore point.

Looking deeper into the WiX source code, it looks like the MSIFASTINSTALL property should only be set if it doesn't already exist:

// Unless the MSI or setup code overrides the default, set MSIFASTINSTALL for best performance.
if (!ChainPackageInfo.HasProperty(db, "MSIFASTINSTALL"))
{
    bool fastInstallSet = false;
    foreach (MsiPropertyInfo propertyInfo in this.MsiProperties)
    {
        if ("MSIFASTINSTALL".Equals(propertyInfo.Name, StringComparison.Ordinal))
        {
            fastInstallSet = true;
            break;
        }
    }

    if (!fastInstallSet)
    {
        this.MsiProperties.Add(new MsiPropertyInfo(this.Id, "MSIFASTINSTALL", "7"));
    }
}

I'm seriously stumped here - does anyone know how I can get this working?

Upvotes: 1

Views: 1810

Answers (2)

Matt Williams
Matt Williams

Reputation: 1714

I've figured out why the restore point was not created. It turns out the problem had nothing to do with WiX or the System Restore settings in Windows.

I checked the Windows Event Viewer and found that the restore point was not created because "there is a restore point available which is recent enough for System Restore".

enter image description here

Upvotes: 1

cristallo
cristallo

Reputation: 2089

take a look at this wix doc page

wix Chain Element doc

There is a specific attribute (DisableSystemRestore) that can be used for controlling the restore point creation

DisableSystemRestore YesNoType Specifies whether the bundle will attempt to create a system restore point when executing the chain. If "yes" is specified then a system restore point will not be created. The default is "no" which indicates a system restore point will be created when the bundle is installed, uninstalled, repaired, modified, etc. If the system restore point cannot be created, the bundle will log the issue and continue.

NOTE: the restore point creation cannot be forced if it is disabled at OS level

Upvotes: 0

Related Questions