I am working with InstallShield 2018. I’m trying to get the installer to execute a program (with some command line parameters) at the end of the installation. When the installation gets to the point where the program should be run, I get the message: “There is a problem with this Windows Installer package. A program required for this install to complete could not be run.” (with some more details – see below)
The program that I am trying to execute was developed by ourselves using C#, and requires admin rights to run. It has an (integrated) manifest file to enforce this. I am currently installing it with a merge module because this program should be re-usable between different software versions.
To accomplish this I’ve added a “Deferred execution in system context” custom action (type 3682) right before “InstallFinalize” with condition “NOT REMOVE”. I’ve created an entry in the directory table that points to the installation folder of the executable, with the source of the custom action pointing to that entry, and the target being the name of the executable and the command line parameters, i.e.: VersionManager.exe /Register "[ProductName]" /loglevel info
Return processing is set to “Synchronous [Check exit code]”. I’ve tried setting it to ignore the exit code – this works to the extent that the installation seems to complete without problems, but when I examine the log file it has been unable to run the program and I see something like this:
MSI (s) (F0:0C) [10:09:49:724]: Executing op: CustomActionSchedule(Action=RegisterAfterInstall,ActionType=1122,Source=C:\Companyname\VersionManager\,Target=VersionManager.exe /Register "Fully parsed product name" /loglevel info,)
MSI (s) (F0:0C) [10:09:49:740]: Note: 1: 1721 2: RegisterAfterInstall 3: C:\Companyname\VersionManager\ 4: VersionManager.exe /Register "Fully parsed product name" /loglevel info
Info 1721.There is a problem with this Windows Installer package. A program required for this install to complete could not be run. Contact your support personnel or package vendor. Action: RegisterAfterInstall, location: C:\ Companyname\VersionManager\, command:VersionManager.exe /Register "Fully parsed product name" /loglevel info
When I run the given command in the specified location (with admin rights) the installation appears to complete without problems. The only thing I can think of is that somehow the program isn't being executed with admin rights.
When I check the drive the moment the message pops up (when checking the exit code), the files are actually present on the system (I had a problem with that earlier, it produced a different error message).
I found a post somewhere that suggested changing the action type to “Commit execution in system context” (because the program depends on .NET stuff registered in the GAC and that is apparently inaccessible before installfinalize is finished) but that did not help.
I’m not at liberty to share my source code (or at least not all of it), but if the information above is insufficient I may be able to set up a small example project that demonstrates the same problem.
EDIT:
Although I'm still curious why the approach above is not working, I managed to find a workaround. If I include the files of the program directly (instead of via a merge module) and I define a custom action of type 3602 (i.e. "installed with product") it works fine. I didn't try this earlier because I had my mind on getting this working with a merge module. (I'm aware that it would be possible to define a custom action in the merge module, but then I cannot fine tune the command line parameters)
I still do not fully understand why, though.