A.Pissicat
A.Pissicat

Reputation: 3265

Unable to launch .exe in Wix setup

I have a C# application with a wix setup. I have customized the ExitDialog with 2 checkboxes (following this), on used to run my application, the other one to run an optional install (for uEye camera).

The first checkbox is :

<!-- Set checkbox for launch my application -->
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch $(var.product)"/>    
<CustomAction Id="SetExecVR3" Property="WixShellExecTarget" Value="[#MyApplication.exe]"/>
<CustomAction Id="DoExec" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" Return ="ignore"/>    

The second :

<!-- Set checkbox for launch install uEye -->
<Property Id="WIXUI_EXITDIALOGUEYECHECKBOXTEXT" Value="Launch install uEye"/>    
<CustomAction Id="SetExecUEye" Property="WixShellExecTarget" Value="./Resources/uEye64_47100_WHQL.exe"/>

And there is my Wix UI (this helped me):

<UI>
  <UIRef Id="WixUI_Custom"/>
  <Publish Dialog="MyExitDialog"
           Control="Finish" 
           Event="DoAction" 
           Value="SetExecVR3">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
  <Publish Dialog="MyExitDialog"
           Control="Finish" 
           Event="DoAction" 
           Value="DoExec">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>

  <Publish Dialog="MyExitDialog"
           Control="Finish" 
           Event="DoAction" 
           Value="SetExecUEye">WIXUI_EXITDIALOGUEYECHECKBOX = 1 and NOT Installed</Publish>
  <Publish Dialog="MyExitDialog"
           Control="Finish" 
           Event="DoAction" 
           Value="DoExec">WIXUI_EXITDIALOGUEYECHECKBOX = 1 and NOT Installed</Publish>
</UI>

There is my Setup :

Setup tree

The check bock for MyApplication.exe works good, the other one didn't. The generation didn't copy uEye64_47100_WHQL.exe in local directory and when I check the option nothing append.

I'm beginning with WiX, what did I miss ?

Edit:

Now I have a component with the .exe. The file is copied but I'm unable to run it. In log with msiexec I Have :

MSI (c) (C4:B8) [12:45:35:109]: Note: 1: 2228 2: 3: Error 4: SELECT Message FROM Error WHERE Error = 1721 Info 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: SetExecUEye, location: C:\uEye64_47100_WHQL.exe, command:

I don't understand this error, and I don't know why the file is in C:\ (I used SourceDir to locate it)

Edit2:

The component created:

  <Component Id="uEye64_47100_WHQLexe" Directory="TARGETDIR" Guid="{1BD47632-42D5-4C56-B207-1E6B1005488C}">
    <File Id="uEye64_47100_WHQLexe" Source="./Resources/uEye64_47100_WHQL.exe" KeyPath="yes" Checksum="yes" Compressed="no" Vital="no"/>
  </Component>

And the directory:

<Fragment>
  <Directory Id="TARGETDIR" Name="SourceDir">
    <Directory Id="ProgramMenuFolder">
      <Directory Id="ApplicationProgramsFolder" Name="$(var.compagny)"/>
    </Directory>
    <Directory Id="DesktopFolder" SourceName="Desktop"/>
    <Directory Id="ProgramFilesFolder">
      <Directory Id="PRODUCTFOLDER" Name="$(var.compagny)">
        <Directory Id="INSTALLFOLDER" Name="$(var.product)">            
          <Directory Id="fr" Name="fr"/>   
        </Directory>
      </Directory>
    </Directory>
  </Directory>
</Fragment>

How can define uEye64_47100_WHQLexe to be copied only in my release folder ? TARGETDIR is set to C:\

Upvotes: 0

Views: 1079

Answers (1)

Mischo5500
Mischo5500

Reputation: 796

You must create another component for your uEye64_47100_WHQL.exe as for your main .exe, if you want to copy it and run on installation. If it is located only in Resource folder, it can be referenced only at the time of compilation as File source, because it is not added to installer itself. So create component like

<Component Id="uEye64_47100_WHQLexe" Directory="APPLICATIONFOLDER" Guid="*">
    <File Id="uEye64_47100_WHQLexe" Source="./Resources/uEye64_47100_WHQL.exe" KeyPath="yes" Checksum="yes" />
</Component>

and then you can use it in custom action using WixShellExec like for MyApplication.exe. But I would advise to define custom action for both files like

<CustomAction Id="RunuEye64_47100_WHQLexe" FileKey="uEye64_47100_WHQLexe" ExeCommand="" Return="ignore" Impersonate="yes" />

because it can be used directly without messing with WixShellExecTarget property ;-)

Publish part of UI will than be

Event="DoAction" 
Value="RunuEye64_47100_WHQLexe">

Upvotes: 1

Related Questions