Wix 卸载完成后打开网页

发布于 2024-08-13 17:39:26 字数 63 浏览 2 评论 0原文

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

谢谢。

I'm using Wix3. I need to open a web page when the user uninstalls the product.
Any ideas how it can be done?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

倾城泪 2024-08-20 17:39:26

这是我们使用的代码示例,我们实际上并没有在编译时设置 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>

Here's a sample of the code we use, we don't actually set the URL at compile time, but update properties in the MSI post-build so this might seem a little "over engineered". We use the WiXShellExec CA and have an additional condition so that the webpage is only displayed during uninstall, and not during a major upgrade.

<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>
小鸟爱天空丶 2024-08-20 17:39:26

将这些 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 属性 值变为已知。

Add these XML elements somewhere under your <Product> element:

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

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

The REMOVE="ALL" condition will make sure the custom action is executed only if the product is being completely removed.

The After="InstallValidate" makes sure that the custom action is executed right after the REMOVE property value becomes known.

屋顶上的小猫咪 2024-08-20 17:39:26

FireGiant 提供的示例 启动 Internet 对我不起作用,但它激励我提出自己的解决方案,如下所示。

条件未安装表示新安装,而已安装表示仅在卸载时触发。

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

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>
醉酒的小男人 2024-08-20 17:39:26

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

<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>

Here is what I did for both install and uninstall:

<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>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文