【问题标题】:Wix Open web page when uninstall completes卸载完成时打开网页
【发布时间】:2019-05-03 23:40:03
【问题描述】:

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

谢谢。

【问题讨论】:

    标签: wix windows-installer wix3


    【解决方案1】:

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

    【讨论】:

      【解决方案2】:

      &lt;Product&gt; 元素下的某处添加这些 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 周围加上 &amp;quot; 标记。
      • 缺少“AND NOT UPGRADINGPRODUCTCODE”。
      • 如果您想使用系统默认浏览器(chrome、firefox 等),您可以改用ExeCommand="cmd.exe /c start https://google.com"
      • @PhonicUK:对我来说,显示的解决方案已经使用默认浏览器,它是我系统上的 chrome。注意 explorer.exe(文件管理器)和 iexplore.exe(IE 浏览器)之间的区别。
      【解决方案3】:

      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>
      

      【讨论】:

        【解决方案4】:

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

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

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2012-05-15
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2012-05-13
          • 1970-01-01
          相关资源
          最近更新 更多