简体   繁体   English

无法在Wix设置中启动.exe

[英]Unable to launch .exe in Wix setup

I have a C# application with a wix setup. 我有一个带有wix设置的C​​#应用​​程序。 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). 我已自定义ExitDialog并带有2个复选框(在复选框之后),用于运行我的应用程序,另一个用于运行可选安装(用于uEye相机)。

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): 还有我的Wix UI( 对我有帮助):

<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 : 这是我的设置:

设置树

The check bock for MyApplication.exe works good, the other one didn't. MyApplication.exe的检查框工作正常,而另一个则没有。 The generation didn't copy uEye64_47100_WHQL.exe in local directory and when I check the option nothing append. 一代人没有在本地目录中复制uEye64_47100_WHQL.exe ,当我检查该选项时,没有附加任何内容。

I'm beginning with WiX, what did I miss ? 我从WiX开始,我想念什么?

Edit: 编辑:

Now I have a component with the .exe . 现在,我有了.exe组件。 The file is copied but I'm unable to run it. 该文件已复制,但无法运行。 In log with msiexec I Have : 在与msiexec的日志中,我有:

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. MSI(c)(C4:B8)[12:45:35:109]:注意:1:2228 2:3:错误4:从Error WHERE Error选择Message = 1721信息1721。Windows Installer存在问题包。 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: 行动:SetExecUEye,位置:C:\\ uEye64_47100_WHQL.exe,命令:

I don't understand this error, and I don't know why the file is in C:\\ (I used SourceDir to locate it) 我不明白此错误,也不知道文件为什么在C:\\中(我使用SourceDir来定位它)

Edit2: 编辑2:

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 ? 如何定义uEye64_47100_WHQLexe仅复制到我的发行版文件夹中? TARGETDIR is set to C:\\ TARGETDIR设置为C:\\

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. 如果要复制它并在安装时运行,则必须为您的uEye64_47100_WHQL.exe创建另一个组件,如同创建主.exe一样。 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. 如果它仅位于Resource文件夹中,则只能在编译时作为文件源引用,因为它没有添加到安装程序本身。 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 . 然后你可以用用它的自定义操作WixShellExecMyApplication.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 ;-) 因为它可以直接使用而不会弄乱WixShellExecTarget属性;-)

Publish part of UI will than be UI的发布部分将是

Event="DoAction" 
Value="RunuEye64_47100_WHQLexe">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM