Executing an EXE file in WiX

12,899

I have some other concerns about what you are doing here, but if you really need to go out of process to an EXE to complete your install, then I'd suggest using the Quiet Execution Custom Action.

You should know though that this isn't a good practice for a number of reasons. 1) It's not declarative, 2) it doesn't support rollbacks. There are others but those are the biggest IMO.

BTW, WiX isn't "scripting". Understand that and you'll understand why not to call EXE's.

Share:
12,899
pawelek
Author by

pawelek

Updated on June 04, 2022

Comments

  • pawelek
    pawelek almost 2 years

    I try to execute an EXE file from an MSI file in WiX, but I got 1603 error when doing InitializeSetup.

    Action ended 12:09:54: InstallValidate. Return value 1.
    Action start 12:09:54: InstallInitialize.
    Action ended 12:09:54: InstallInitialize. Return value 3.
    Action ended 12:09:54: INSTALL. Return value 3.
    

    What is wrong in this WiX Script?

     <Product Name='something' Id='11934d63-12d1-4792-829e-046de3bb987e'
      UpgradeCode='{a101616a-365c-44a7-bfcb-fafb356c2ea1}'
      Language='1033' Version='8.3.4' Manufacturer='something2'>
    
        <Package Id='*' InstallerVersion='200' Compressed='yes' />
    
        <Binary Id="Instalator.exe" SourceFile="d:\Instalator.exe"/>
        <CustomAction Id="LaunchFile" BinaryKey="Instalator.exe" ExeCommand="" Execute='deferred' Return='asyncNoWait' Impersonate='no'/>
        <InstallExecuteSequence>
            <Custom Action='LaunchFile' Before='InstallFinalize'/>
        </InstallExecuteSequence>
     </Product>
    

    I don't know why, but when I add:

    <Directory Id='TARGETDIR' Name='SourceDir'>
            <Component Id='MainExecutable' Guid='1193cd63-12d1-4792-829e-046de3bb987e'>
            </Component>
    </Directory>
    
    <Feature Id='Complete' Level='1'>
      <ComponentRef Id='MainExecutable' />
    </Feature>
    

    after Package node -> then it works fine. I need to figure out why...

  • Aelphaeis
    Aelphaeis almost 10 years
    I have a file that has compressed dependencies for my project. Executing that file puts those dependencies in the directory it is in. Is this also considered bad practice? what do you suggest as an alternative?