0

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:\

Community
  • 1
  • 1
A.Pissicat
  • 3,023
  • 4
  • 38
  • 93

1 Answers1

1

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">
Mischo5500
  • 796
  • 6
  • 14
  • I modified both `CustomAction`, now I have just one `Publish` by Action :-). I also added the component for the uEye.exe. Now the file is copied into my install folder. But when I check the "Launch install uEye" box, cursor goes to wait for 1 second, setup close and nothing happens. The .exe file require administrator privileges, is there the reason ? – A.Pissicat Sep 13 '16 at 10:22
  • 1
    So now it copies file to install location, but tries to run it from C:\ ? Can you please add Component and CustomAction code, as it looks now, ideally with structure too? Btw SourceDir means root dir, from which is directory tree created, so it is C:\ – Mischo5500 Sep 13 '16 at 11:06
  • I edited the post, after research I saw that error 1721 can be because application need more privileges. The exe is copied in C:\ (instead of [MyApplication]\bin\Release) but it is correctly called from there. – A.Pissicat Sep 13 '16 at 11:54
  • 1
    You can edit, where to place during instalation, with Directory setting in your component. `Directory="TARGETDIR"` means SourceDir, which is `C:` . If you use `Directory="INSTALLFOLDER"` file should be placed to `C:\Program Files(x86)\Company\Product`. If you want to nest it further in this structure, just define another directory in ``, for example `` for bin folder and in it another `` for Release folder. Then just set `Directory="RELEASEFOLDER"` for your component. – Mischo5500 Sep 13 '16 at 12:47