【发布时间】:2019-05-03 23:40:03
【问题描述】:
我正在使用 Wix3。当用户卸载产品时,我需要打开一个网页。
有什么想法可以做到吗?
谢谢。
【问题讨论】:
标签: wix windows-installer wix3
我正在使用 Wix3。当用户卸载产品时,我需要打开一个网页。
有什么想法可以做到吗?
谢谢。
【问题讨论】:
标签: wix windows-installer wix3
这是我们使用的代码示例,我们实际上并没有在编译时设置 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>
【讨论】:
在 <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 值之后立即执行自定义操作。
【讨论】:
PushButtons 一起使用。我唯一建议的是在 URL 周围加上 &quot; 标记。
ExeCommand="cmd.exe /c start https://google.com"。
FireGiant Launch the Internet 提供的示例对我不起作用,但它激励我提出自己的解决方案,如下所示。
条件未安装表示全新安装,已安装表示仅在卸载时触发。
<CustomAction Id="LaunchBrowser" Directory="INSTALLDIR" Return="asyncNoWait" ExeCommand="explorer.exe http://www.google.com/" />
<InstallExecuteSequence>
<Custom Action="LaunchBrowser" After="InstallFinalize">Installed</Custom>
</InstallExecuteSequence>
【讨论】:
这是我为安装和卸载所做的:
<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>
【讨论】: