Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the text shown while NGen is running in a WiX MSI package

Tags:

wix

ngen

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

like image 488
wigy Avatar asked Jan 07 '23 01:01

wigy


2 Answers

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>
like image 160
leshy84 Avatar answered Apr 24 '23 17:04

leshy84


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>
like image 23
Stephen Reindl Avatar answered Apr 24 '23 17:04

Stephen Reindl