2

I have created two windows-installer A.msi and B.msi. I want B.msi should start after completion of A.msi. How can I add some functionality in A.msi which start another installer. I am using Wix.

I add CustomAction in .wxs file

<CustomAction ExeCommand="cmd.exe /k msiexec.exe /i "[SourceDir]B.msi"" Return="asyncNoWait" Execute="immediate" Id="RunSecondMSI"  /> 

AND in InstallExecuteSequence table

<InstallExecuteSequence>
 <Custom Action="RunSecondMSI" Before="InstallFinalize">NOT Installed</Custom>
</InstallExecuteSequence> 

Thanks

Sukhjeevan
  • 3,074
  • 9
  • 46
  • 89

2 Answers2

2

Try launching the second MSI through a custom action scheduled after InstallFinalize (in InstallExecuteSequence table). This custom action should use the msidbCustomActionTypeAsync and msidbCustomActionTypeContinue flags (asynchronous execution, do not wait for return).

You cannot launch another MSI directly, but you can try using "cmd.exe /k". For example:

cmd.exe /k msiexec.exe /i "[SourceDir]B.msi"

SourceDir property is automatically set to the package folder path (I assumed the MSI files are in the same folder).

Cosmin
  • 21,216
  • 5
  • 45
  • 60
  • Hi,Can u see image i have added in which i add custom action called RunSecondMSI and set its property.Now how can i set msidbCustomActionTypeAsync and msidbCustomActionTypeContinue flags?? and where i have to write command "cmd.exe /k msiexec.exe /i "[SourceDir]B.msi"" – Sukhjeevan Dec 03 '10 at 04:35
  • I have done some modification in Question.Would that changes work?? – Sukhjeevan Dec 03 '10 at 05:54
  • Did you see modification in Question. – Sukhjeevan Dec 03 '10 at 08:06
  • The changes seem to be correct. Please escape the quotes in ExeCommand by using ". Also, in InstallExecuteSequence the custom action should run "After" InstallFinalize. – Cosmin Dec 06 '10 at 10:20
  • Hi Cosmin,this solution really worked for me.But after completion of A.msi a command line prompt window appears on screen and remain until B.msi complete its installation process.Can we write any syntax in ExeCommand property so that when this hit B.msi command line prompt window should automatically close. – Sukhjeevan Dec 06 '10 at 13:11
  • Try removing the cmd.exe part: msiexec.exe /i "[SourceDir]B.msi" – Cosmin Dec 06 '10 at 14:35
  • I tried ExeCommand="msiexec.exe /i "[SourceDir]B.msi"" And also ExeCommand="/k msiexec.exe /i "[SourceDir]B.msi"" but its not working. – Sukhjeevan Dec 07 '10 at 04:34
  • how do i get complete folder path where i put A.msi & B.msi files.Currently i am using ExeCommand="cmd.exe /k msiexec.exe /i [WindowsFolder]\B.msi" that's why i have to put both A.msi and B.msi file in WINDOWS folder.but end user can put it in C:\,D:\ etc. drive. – Sukhjeevan Dec 07 '10 at 04:58
  • I tried $(sys.CURRENTDIR)\B.msi , $(sys.SOURCEFILEDIR)\B.msi but not working. – Sukhjeevan Dec 07 '10 at 05:47
  • SourceDir property should be automatically resolved to the folder from which the MSI is launched. Did you escape the quotes by using "? – Cosmin Dec 07 '10 at 07:38
  • I am trying for this one.My question is regarding "Try removing the cmd.exe part:" that posted earlier I tried ExeCommand="msiexec.exe /i "[SourceDir]B.msi"" And also ExeCommand="/k msiexec.exe /i "[SourceDir]B.msi"" but its not working. – Sukhjeevan Dec 07 '10 at 11:18
  • I should be ExeCommand="msiexec.exe /i "[SourceDir]B.msi"". If it doesn't work you can try creating a log of the main install to see what command line is used for the custom action. – Cosmin Dec 08 '10 at 07:31
  • Thanks Cosmin! I'll try for that. – Sukhjeevan Dec 08 '10 at 08:57
1

You need a bootstrapper for this kind of scenarios. Your question seems to duplicate this one

Community
  • 1
  • 1
Yan Sklyarenko
  • 31,557
  • 24
  • 104
  • 139