pawelek
pawelek

Reputation: 111

Executing an EXE file in WiX

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...

Upvotes: 3

Views: 13519

Answers (3)

Jhon
Jhon

Reputation: 1

Important note for WIX, After completion of all application installation then the .sql file or database files runs through wix or wpf or winform application.

Upvotes: 0

caveman_dick
caveman_dick

Reputation: 6667

Because you are running the exe as a deferred action, it runs in the context of the SYSTEM account. This error is due to the system account not having the required permissions on the file system http://support.microsoft.com/kb/834484.

It is possible to get around this using PowerShell to execute the exe using the -RunAs switch, but this is a bit nasty. It really all depends exactly what you are doing in the exe as to the best course of action. I'm with Mr. Painter, using an EXE should be the last resort.

Another option is to move the exe setup code so that it runs the first time the user runs the app.

Upvotes: 0

Christopher Painter
Christopher Painter

Reputation: 55600

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.

Upvotes: 5

Related Questions