卸载完成后Wix打开网页

时间:2009-11-30 12:58:19

标签: wix windows-installer wix3

我正在使用Wix3。当用户卸载产品时,我需要打开一个网页 有什么想法可以做到吗?

感谢。

4 个答案:

答案 0 :(得分:20)

以下是我们使用的代码示例,我们实际上并没有在编译时设置URL,而是在MSI后期构建中更新属性,因此这可能看起来有点“过度设计”。我们使用WiXShellExec CA并具有附加条件,以便网页仅在卸载期间显示,而不是在主要升级期间显示。

<Fragment>
    <Property Id="MyURL"><![CDATA[http://www.blah.blah.blah/]]></Property>
    <CustomAction Id="SetOpenURL" Property="WixShellExecTarget" Value="[MyURL]" />
    <CustomAction Id="OpenURL" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" Return="ignore" />

    <InstallExecuteSequence>
        <!-- Launch webpage during full uninstall, but not upgrade -->
        <Custom Action="SetOpenURL" After="InstallFinalize"><![CDATA[REMOVE ~= "ALL" AND NOT UPGRADINGPRODUCTCODE]]></Custom>
        <Custom Action="OpenURL" After="SetOpenURL"><![CDATA[REMOVE ~= "ALL" AND NOT UPGRADINGPRODUCTCODE]]></Custom>
    </InstallExecuteSequence>
</Fragment>

答案 1 :(得分:4)

<Product>元素下的某处添加这些XML元素:

  <CustomAction Id="LaunchBrowser"
        ExeCommand="explorer.exe http://www.google.com"
        Directory="INSTALLDIR"
        Return="asyncNoWait" >
     REMOVE="ALL"
  </CustomAction>

  <InstallExecuteSequence>
     <Custom Action="LaunchBrowser" After="InstallValidate"/>
  </InstallExecuteSequence>

REMOVE="ALL"条件将确保仅在完全删除产品时才执行自定义操作。

After="InstallValidate"确保在REMOVE property值知晓后立即执行自定义操作。

答案 2 :(得分:0)

The example provided by FireGiant Launch the Internet doesn't work for me but it inspire me to come out my own solution as below.

The condition NOT Installed mean new installation while Installed means it only trigger when uninstall.

<CustomAction Id="LaunchBrowser" Directory="INSTALLDIR" Return="asyncNoWait" ExeCommand="explorer.exe http://www.google.com/" />
<InstallExecuteSequence>
    <Custom Action="LaunchBrowser" After="InstallFinalize">Installed</Custom>
</InstallExecuteSequence>

答案 3 :(得分:0)

这是我所做的安装和卸载操作:

<Product>

...

<CustomAction Id="LaunchBrowserInstall" Directory="TARGETDIR" Execute="immediate" Impersonate="yes" Return="asyncNoWait" ExeCommand="explorer.exe https://www.example.com/post_install/" />

    <CustomAction Id="LaunchBrowserUninstall" Directory="TARGETDIR" Execute="immediate" Impersonate="yes" Return="asyncNoWait" ExeCommand="explorer.exe https://www.example.com/post_uninstall/" />

    <InstallExecuteSequence>
        <Custom Action="LaunchBrowserInstall" After="InstallFinalize">NOT Installed AND NOT REMOVE</Custom>
        <Custom Action="LaunchBrowserUninstall" After="InstallFinalize">REMOVE ~= "ALL"</Custom>
    </InstallExecuteSequence>

...

</Product>