Attended mode takes much more time than unattended mode

Dec 3, 2015 at 5:58 PM

I have a Managed Setup with Embedded UI, installing an application containing about 400 files. If I run the setup in attended mode, it takes 10 times more time than if I run it in silent mode. ( 7 minutes vs 40 seconds).
I looked into the log file and every single operation takes more time in attended mode. (register component, copy file, etc)
Surprisingly, my custom actions take the same time in both installation modes.
I tried to set MSIFASTINSTALL = 7, but I did not see any improvement.

Is there a chance to speed up the installation between Ready To Install and Completed Successfully dialogs?
Thank you.
Dec 4, 2015 at 12:13 AM
It is really outside of Wix# domain :)

Wix# is only responsible for authoring MSI and it cannot possibly control MSI performance at runtime. Remember Wix# is a compilation tool but not a runtime system. Effectively it has as much to do with MSI performance as VisualStudio with the performance of the application it compiled.

True, Wix# implements navigation between ManagedUI (specific case of EmbeddedUI) dialogs, but not for the hosting EmbeddedUI itself. And it seems that the navigation is not where you get you performance penalty. BTW EmbeddedUI hosting is not actually a Wix# feature but MSI/WiX one.

I would suggest that you (for the sake of experiment) build your msi file with the EmbeddedUI provided by WiX samples and see if there any performance difference. It is very easy, you just use <wix# samples>/Custom_UI/EmbeddedUI sample as the VS project.
Dec 9, 2015 at 10:34 AM
Edited Dec 9, 2015 at 10:35 AM
I have tried many settings to improve the installation time.

I tried <wix# samples>/Custom_UI/EmbeddedUI sample with my files, and I got the same installation time for attended and unattended modes (the longer time).

At some point, I tried to remove the embedded cabinet file from MSI file and bingo, the clean installation time dropped off from 7 minutes to 2 minutes. So it seems that not embedding the cabinet file is a solution for me for UI installations to run faster.
Dec 9, 2015 at 12:16 PM
Indeed Wix# uses the "canonical WiX " project template as a starting point and it has EmbedCab set to 'yes'. I did not expect this setting to affect performance unless your MSI is huge. Though may be it is your case.

You probably found that you can control embedding via Project.Media element:
 project.Media.AttributesDefinition = @"Id=1; EmbedCab=no";
Thank you for sharing the solution/work around. I will reflect it on Wiki.
Dec 10, 2015 at 5:40 AM
Edited Dec 10, 2015 at 5:41 AM
After some additional tests I found that there is a small opportunity for some performance improvements from within Wix#.

Managed Setup schedules multiple custom actions to be fired in order to invoke user supplied event handlers. These custom actions (as any CA) trigger loading MSI in memory at runtime and it hurts the performance when the the msi size is large. There is nothing we can do about this except your trick with EmbedCab=no.

Wix# scheduling for these custom actions is already optimized: if you do not subscribe for the events the CAs will not be scheduled. It's all good. However there is a one single action that is scheduled always - WixSharp_InitRuntime_Action. In this action the most important MSI properties are pushed into Session.CustomActionData so they are available for the deferred actions. These properties are typically (but not always) consumed from other custom actions (e.g. Project.AfterInstall event) and they are:
  • Installed
  • ProductName
  • UILevel
Wix# schedules this CA always because it cannot possible know that the developer is (or is not) going to use these properties. However in cases like yours you may decide that you are definitely not going to use these properties thus it may be useful to allow to suppress this CA scheduling. And this is exactly what the new ManagedProject.AlwaysScheduleInitRuntime member does. The following code will generate msi that doesn't invoke any custom action at all.
 var project = new ManagedProject("ManagedSetup",
                            new Dir(@"%ProgramFiles%\My Company\My Product",
                                new File(@"..\Files\bin\MyApp.exe")));
project.ManagedUI = ManagedUI.Default;
project.AlwaysScheduleInitRuntime = false;
You can get the release (v1.0.30.1) with the change from nuget:
PM> Install-Package WixSharp.bin -Pre
Dec 10, 2015 at 2:01 PM
Edited Dec 10, 2015 at 2:02 PM
I have to apologize, the time improvement is not so notable as I said.
My first tests were done by a colleague on another test machine than me.
Please don't consider removing the embedded cabinet from MSI as a big time improvement.
Sorry again.
Dec 11, 2015 at 12:37 AM
Not a problem. Anyway there is something good that came out of it: ManagedProject.AlwaysScheduleInitRuntime.
Jan 4, 2016 at 11:02 AM
I just want to mention, that in my case the culprit for the long installation time was the "!" value in the MsiLogging parameter. Maybe somebody runs into the same problem.