Custom actions do not execute on the ExitDialog dialog in AdvancedInstaller after .NET Framework prerequisite installation and reboot

When using AdvancedInstaller you may find that custom actions do not execute on the ExitDialog dialog (for example when you click a butto) after .NET Framework prerequisite installation and reboot.

The AdvancedInstaller installation will correctly continue after the .NET Framework installation reboot however the buttons on the exit page don't work.

For an Open URL action you can simply tick the "Wait for custom action to finish before proceeding" checkbox. The URL will actually open and the install continue as normal.



For an actual .exe file you need to find a way to create a custom action that executes the application. We found there were several ways to do this however each had issues

  • Using VBScript to execute a file caused the file to execute behind the installer window

  • Using an inline PowerShell script executes the application correctly in front of the installer window, however on some test machines this look several seconds before the application started

  • You can also create your own application that essentially executes the "real" application without waiting and self terminates.

  • Execute a batch file that runs a "start" command

  • Configure your application with a silent restart switch


Configure your application with a silent restart switch
This is a bit of a strange solution but is actually simpler in terms of testing if you have control of your own application that your executing. The application starts and checks its command line parameters.

If a parameter "/silentrestart" is passed then the application terminates and restarts itself without the switch. The original process is therefore ended and the AdvancedInstaller/Windows installer is happy.

                SerializableStringCollection commandLineArguments = new SerializableStringCollection(Environment.GetCommandLineArgs());
                if (commandLineArguments.Contains("/silentrestart"))
                {
                    String path = Assembly.GetEntryAssembly().Location;
                    Application.Exit();
                    Process.Start(path);
                    return;
                }

Comments

Popular posts from this blog

Windows Server 2016, 2019, 2022, Windows 10 and Windows 11: Date and time "Some settings are managed by your organization".

TFTPD32 or TFTPD64 reports Bind error 10013 An attempt was made to access a socket in a way forbidden by its access permissions.

Enable function lock for F1-F12 on HP ZBook mobile workstations