我的代码有什么问题。在“ExitDialog”上检查“EXITDIALOGOPTIONALCHECKBOX”后,我无法运行app。
<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'时,我将使用app来午餐。我真的需要这个自定义操作因为我运行的其他自定义操作(在代码下面)来改变'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"/>
请帮忙。
更新
最后,我在本文档中找到了解决方案: wix documentation
即使使用管理员权限,应用也会启动。
答案 0 :(得分:0)
有条件地在安装后启动应用程序
有两种方法可以将复选框添加到安装的最后一页,以便有条件地启动应用程序。第一个在WiX 3中受支持,无需对原始对话框进行任何更改,但它有一个主要限制。
最后一个对话框(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>
查看代码后,您似乎有两个启动应用程序的自定义操作,您只需要一个(LaunchApplication)。
在这部分
<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>