We are using NGen during installation to optimize startup time of our application.
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
...
<File Id="File.$(var.ProjectName.TargetName).exe" Source="$(var.ProjectName.TargetPath)" KeyPath="yes">
<netfx:NativeImage Id="ngen.File.$(var.ProjectName.TargetName)" Platform="$(var.NgenPlatform)" Priority="0" AppBaseDirectory="INSTALLLOCATION"/>
</File>
...
</Wix>
While installing the resulting MSI the step "removing backup files" took extremely long time compared to other steps. Digging into it we found out that the NGen is running at that time.
How could we write something else there, like "we are now saving lots of time for you later on every startup of your application"?
Actually there is a better way since there are two actions NetFxExecuteNativeImageCommitInstall (called in case of enabled rollback) and NetFxExecuteNativeImageInstall (in case of disabled rollback) in NetFx WiX extension.
<UI>
<ProgressText Action="NetFxExecuteNativeImageInstall">Speeding up your application</ProgressText>
</UI>
<InstallExecuteSequence>
<Custom Action="NetFxExecuteNativeImageCommitInstall" After="NetFxExecuteNativeImageUninstall">0</Custom>
<Custom Action="NetFxExecuteNativeImageInstall" After="NetFxExecuteNativeImageCommitInstall" />
</InstallExecuteSequence>
This is discussed already as a feature request here. You may move the ngen activities to the background as discussed here.
Another option is to change the text of the "removing backup files" label by replacing the action text for the InstallFinalize action:
<UI>
<ProgressText Action="InstallFinalize">Speeding up your application beforehand :)</ProgressText>
</UI>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With