cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
john_hall
Level 4

Custom Action Launch Executable

I'm having a bit of trouble launching an executable during my Basic MSI installation. Here is part of the script I use with the automation interface:

[code]
' Add vcredist executable separately to give us access to file key
Set dfl = compUtilMain.ISWiDynamicFileLinkings(1)
Set compVcRedist = project.AddComponent("VC_REDIST")
compVcRedist.Destination = "[INSTALLDIR]" & strProductDir & "\bin"
If arch = "32" Then
dfl.ExcludeFiles = "vcredist_x86.exe"
Set vcRedistExe = compVcRedist.addFile(strUtilsBin & "\vcredist_x86.exe")
Else
dfl.ExcludeFiles = "vcredist_x64.exe"
Set vcRedistExe = compVcRedist.addFile(strUtilsBin & "\vcredist_x64.exe")
End If

Set action = project.AddCustomAction("VC_REDIST")
action.ActionType = 18 ' Run exe using file installed with this MSI
action.Name = "VC_REDIST"
action.Source = vcRedistExe.Name
action.Target = ""
Set seq = project.InstallExecuteSequence
seqNum = 6500 ' between ScheduleReboot and InstallFinalize
seq.InsertCustomAction action, "MSVCREDIST", "1", seqNum

Set featUtil = project.AddFeature("UTILS")
featUtil.AttachComponent(compVcRedist)
[/code]

The log:
[code]
MSI (s) (18:24) [14:37:23:082]: Doing action: VC_REDIST
Action 14:37:23: VC_REDIST.
Action start 14:37:23: VC_REDIST.
MSI (s) (18:24) [14:37:23:098]: Note: 1: 1721 2: VC_REDIST 3: C:\Program Files\ESI_Software\UTILS_2009.2\bin\vcredist_x86.exe 4:
Error 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: VC_REDIST, location: C:\Program Files\ESI_Software\UTILS_2009.2\bin\vcredist_x86.exe, command:
MSI (s) (18:24) [14:37:45:332]: Product: CFD-UTILS 2009.2 -- Error 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: VC_REDIST, location: C:\Program Files\ESI_Software\UTILS_2009.2\bin\vcredist_x86.exe, command:

Action ended 14:37:45: VC_REDIST. Return value 3.
[/code]

I've already tried using executable/property (didn't seem to understand [INSTALLDIR]) and executable/directory (error about directory database being uninitialized). I realize this could probably be done with a merge module, but my employer does not want to send out an executable, only an msi.

Any help would be appreciated.
Labels (1)
0 Kudos
(4) Replies
RobertDickau
Flexera Alumni

One thing to verify for a custom action launching a file that you're installing is that the action is scheduled for deferred execution (after InstallFiles if during the initial installation, and before RemoveFiles during uninstallation); so you might need to touch up the ActionType field...
0 Kudos
john_hall
Level 4

OK, I made the change. Now the action type is 18+1024. But it still runs during the MSI installation, and the executable complains that another installation is running. It needs to run after my installation completes. Is that even possible?
0 Kudos
RobertDickau
Flexera Alumni

Correct, only one deferred Execute sequence can run at a time. Normally you would handle this with a prerequisite, perhaps feature-based, but that requires setup.exe. A shabby option might be (I haven't tried it) to launch the EXE in immediate mode after InstallFinalize, but there are privileges and other potential issues there.
0 Kudos
john_hall
Level 4

That gives the same error. I will try to convince them to allow me to use setup.exe.

The Visual C++ merge modules should be equivalent, correct? I'm not sure what the Policy ones are. Should I include those as well?

Thanks.
0 Kudos