Sofiane
Sofiane

Reputation: 950

How to call an MSI file from another without being a part of the caller installer with WIX

I have a little issue which is that I have to call an MSI file from another MSI file.

Both of them are independant meaning that they don't belong to the same installation.

Is it possible to make it with CustomAction ?

I know it's possible if I use bootstrapper but I can't do it this way.

<

?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Product Id="*" Name="MySetup" Language="1033" Version="1.0.0.0" Manufacturer="Sofiane" UpgradeCode="c151e7ab-b83a-445f-93b2-2ab7122ea34b">
    <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <MediaTemplate />

    <Property Id="EXEPATH" Secure="yes"/>

    <Feature Id="ProductFeature" Title="MySetup" Level="1">
      <ComponentGroupRef Id="ProductComponents" />
    </Feature>
    <Binary Id="InstallTools" SourceFile="$(var.SolutionDir)InstallTools\bin\$(var.Configuration)\InstallTools.CA.dll"/>
    <CustomAction Id="SetupProps" BinaryKey="InstallTools" DllEntry="OpenExeUrl" Execute="immediate" Impersonate="yes" Return="check" />
    <CustomAction Id="OpenExe" Return="ignore" Directory="exeDirectory"  ExeCommand="&quot;[EXEPATH]&quot;" Impersonate="yes" Execute="deferred"/>

    <InstallExecuteSequence>
      <Custom Action="SetupProps" Before="OpenExe"/>
      <Custom Action="OpenExe" After="InstallExecute"/>
    </InstallExecuteSequence>
  </Product>

  <Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder">
        <Directory Id="INSTALLFOLDER" Name="MySetup" />
      </Directory>
      <Directory Id="exeDirectory" FileSource="@(EXEDIR)" />
    </Directory>
  </Fragment>

  <Fragment>
    <DirectoryRef Id="INSTALLFOLDER">
      <Component Id="myAppFile">
        <File Source="$(var.MyApplication.TargetPath)" />
      </Component>
    </DirectoryRef>
    <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
      <ComponentRef Id="myAppFile" />
    </ComponentGroup>
  </Fragment>

</Wix>

In the custom action OpenExe, EXEPATH is the second MSI file to call.

Any advice please?

Upvotes: 0

Views: 116

Answers (1)

Buzka91
Buzka91

Reputation: 399

If you want to start it from CA you can use

var process = Process.Start(filePath);

But i'm not sure if it will be good with you?

Btw. i'm not sure it will cause problems with installation, maybe you should call your CA with After="ExecuteAction" parametr, i was doing it some time ago, the only thing i recall is that i had problem with please end 1st installation error, that code fix it i belive.

Upvotes: 1

Related Questions