WiX无条件执行应用程序

时间:2010-08-13 20:12:00

标签: windows installer wix custom-action

alo Everyone。

我的问题是双重的。我有一个我一直在研究的WiX项目,并且其任务是让它执行程序执行,无论用户按下取消,安装中止(通过现有版本)或用户成功完成安装。 / p>

我目前使用内置的diaglog系统:

    <UIRef Id="WixUI_InstallDir" />

我目前在安装完成后非常成功地执行了应用程序。困难在于应用程序位于安装程序的相同位置,我无法保证应用程序的位置。因此,在安装成功后,我使用以下方法执行程序:

<InstallExecuteSequence>
  <Custom Action="PreventDowngrading" After="FindRelatedProducts">NEWPRODUCTFOUND</Custom>
  <RemoveExistingProducts After="InstallInitialize" />
  <Custom Action="PropertyAssign"  Before="InstallFinalize">NOT Installed</Custom>
  <Custom Action="LaunchFile" After="InstallFinalize">NOT Installed</Custom>
</InstallExecuteSequence>


    <CustomAction Id='PropertyAssign' Property='PathProperty' Value='[SourceDir][DRIVEREXEC]' />
    <CustomAction Id="LaunchFile" Property="PathProperty" ExeCommand='/S' Return="asyncNoWait" />

安装完成后,这两个自定义操作用于执行应用程序。因此,当程序存在时,我无法分配两个自定义操作。当两个自定义操作具有相同的设置时,OnExit =“error”会引发异常。

如何执行应用程序,位置未知 - 但假设与安装程序位于同一目录中 - 无条件?

我感谢大家的时间和善意回复

1 个答案:

答案 0 :(得分:1)

您可以查看有关如何在设置后运行应用程序的WiX文档:http://wix.sourceforge.net/manual-wix3/run_program_after_install.htm。这将指导您进入WiX UI对话框,如有必要,您可以调整它。

此外,SourceDir使用起来非常棘手:http://robmensching.com/blog/posts/2010/1/26/StackOverflow-what-does-NameSourceDir-refer-to。理想情况下,您将启动安装的应用程序而不是媒体。