Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wix安装后运行应用程序不工作_Wix_Wix3.6 - Fatal编程技术网

Wix安装后运行应用程序不工作

Wix安装后运行应用程序不工作,wix,wix3.6,Wix,Wix3.6,我的代码有什么问题。在ExitDialog上选中ExitDialog OptionalCheckBox后,我无法运行应用程序 <UI> <UIRef Id='WixUI_Minimal'/> <Publish Dialog="ExitDialog" Control="Finish" Order="1" Event="DoAction" Value="LaunchInstalledExe">LAUNCH_APP_ON_EXIT</Publish&g

我的代码有什么问题。在ExitDialog上选中ExitDialog OptionalCheckBox后,我无法运行应用程序

<UI>
  <UIRef Id='WixUI_Minimal'/>
  <Publish Dialog="ExitDialog" Control="Finish" Order="1" Event="DoAction" Value="LaunchInstalledExe">LAUNCH_APP_ON_EXIT</Publish>
</UI>

<Directory Id="TARGETDIR" Name="SourceDir">
    <Directory Id="APPLICATIONROOTDIRECTORY">
      <Directory Id="ProgramMenuFolder">
        <Directory Id="ApplicationProgramsFolder" />
      </Directory>
    <Directory Id="DesktopFolder" />
  </Directory>
</Directory>

<DirectoryRef Id="APPLICATIONROOTDIRECTORY">
  <Component Id="Test.exe" Guid="EF2B3E63-B797-47E6-A1AD-8221F13B6959">
  <File Id="Test.exe" Source="ApplicationFiles\Test.exe" KeyPath="yes" Checksum="yes"/>
</Component>
</DirectoryRef>

<Feature Id="MainApplication" Title="Main Application" Level="1">
  <ComponentRef Id="Test.exe" />
  <ComponentRef Id="ApplicationShortcut" />
  <ComponentRef Id="ApplicationDesktopShortcut" />
</Feature>

<InstallExecuteSequence>
  <Custom Action='ChangeDir' After='CostFinalize' >NOT Installed</Custom>
</InstallExecuteSequence>

<Fragment>
  <CustomAction Id="ChangeDir" Directory="APPLICATIONROOTDIRECTORY" Value="C:\\SampleFolder\"  />
  <CustomAction Id="LaunchApplication" FileKey="Test.exe" ExeCommand="" Execute="immediate" Impersonate="yes" Return="asyncNoWait" />

<CustomAction Id="LaunchInstalledExe"
     FileKey="Test.exe"
     ExeCommand="" 
     Execute="immediate" 
     Impersonate="yes" 
     Return="asyncNoWait" >
</CustomAction>
</Fragment>

<Fragment>

 <DirectoryRef Id="ApplicationProgramsFolder">
   <Component Id="ApplicationShortcut" Guid="FBE47082-5FC5-4861-B113-96BA9D30821F">
    <Shortcut Id="ApplicationStartMenuShortcut"
              Name="Test"
              Description="opis"
              Icon="logo.ico"
              Target="[APPLICATIONROOTDIRECTORY]\Test.exe"
              WorkingDirectory="APPLICATIONROOTDIRECTORY"/>
    <RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
    <RegistryValue Root="HKCU" Key="Software\Test" Name="Test" Type="integer" Value="1" KeyPath="yes"/>

    <!-- Uninstall Shortcut-->
  <Shortcut Id="UninstallProduct"
      Name="Uninstall Test"
      Target="[SystemFolder]msiexec.exe"
      Arguments="/x [ProductCode]"
      Description="Uninstall Test" />

  </Component>
</DirectoryRef>

<!-- desktop shortcut-->
<DirectoryRef Id="DesktopFolder">
  <Component Id="ApplicationDesktopShortcut" Guid="5c9b9050-3846-49c3-8484-910f49d4eddf">
    <Shortcut Id="desktopSC" Target="[APPLICATIONROOTDIRECTORY]\Test.exe"
              Directory="DesktopFolder" Name="Test" IconIndex="0" WorkingDirectory="APPLICATIONFOLDER" Icon="logo.ico" Advertise="no" />
    <RemoveFolder Id="ApplicationDesktopFolder" Directory="DesktopFolder" On="uninstall"/>
    <RegistryValue Root="HKCU" Key="SOFTWARE\Test" Name="Test" Value="1" Type="integer" KeyPath="yes" />
  </Component>
</DirectoryRef>
</Fragment>
当我使用'Custom Action='ChangeDir应用程序rem行时,将使用午餐。我确实需要这个自定义操作,因为我在下面的代码中运行其他自定义操作来更改“APPLICATIONROOTDIRECTORY”

<CustomAction Id="LicenseInfoCustomAction" BinaryKey="CustomActionBinary" DllEntry="ShowLicenseInfo" Execute="immediate" Return="check" HideTarget="yes" />
<Binary Id="CustomActionBinary" SourceFile="$(var.MyCustomAction.TargetDir)$(var.MyCustomAction.TargetName).CA.dll"/>

请帮忙

更新:

最后,我在本文档中找到了解决方案:

应用程序甚至可以使用管理员权限启动。

安装后有条件地启动应用程序

有两种方法可以将复选框添加到安装的最后一页,以便有条件地启动应用程序。WIX3支持第一个对话框,无需对原始对话框进行任何更改,但它有一个主要限制

最后一个对话框ExitDialog有一个可显示的可选复选框,与此复选框关联的属性可用于有条件地启动应用程序。安装文件中的以下条目将添加此复选框

<CustomAction Id="StartAppOnExit" FileKey="YourAppExeId" ExeCommand="" Execute="immediate" Impersonate="yes" Return="asyncNoWait" />
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch Sample App 1.0 when setup exits." />
<UI>
    <Publish Dialog="ExitDialog" Control="Finish" Order="1" Event="DoAction" Value="StartAppOnExit">WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT</Publish>
</UI>
在查看代码之后,您似乎有两个启动应用程序的自定义操作,您将只需要一个启动应用程序

在这部分

<UI>
  <UIRef Id='WixUI_Minimal'/>
  <Publish Dialog="ExitDialog" Control="Finish" Order="1" Event="DoAction" Value="LaunchInstalledExe">LAUNCH_APP_ON_EXIT</Publish>
</UI>
更改以下内容的“发布”对话框:

  <Publish Dialog="ExitDialog" Control="Finish" Order="1" Event="DoAction" Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT</Publish>

感谢您的回答,但更改代码后,我的应用程序仍然无法运行。问题是这行带有自定义操作:“未安装”,当我评论此应用程序将启动时。但是如何使用自定义操作更改install dir,并在安装后运行应用程序请看下面的答案以更改InstallDir您让它工作了吗?