gpt4 book ai didi

c# - 使用 Wix 3.8,当卸载程序打包在 exe 安装程序中时,如何使用 Bundle 卸载 ExePackage?

转载 作者:太空宇宙 更新时间:2023-11-03 12:25:49 26 4
gpt4 key购买 nike

我在 StackOverflow 上查看了几个答案,但找不到解决我目前面临的问题所需的确切内容

我正在使用 Wix 3.8 和 Visual Studio 2008,并且已经创建了一个 XML 部署项目,Bundle.wxs 文件如下所示。

这是我的 Bundle.wxs 文件

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:bal="http://schemas.microsoft.com/wix/BalExtension"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension" >

<Bundle Name="SomeCompanyBundle"
Version="1.0.0.0"
Manufacturer="Some Company"
UpgradeCode="348d9d7c-6a37-44cd-8054-61b97777b5bd"
IconSourceFile="..\Some Company\logo_64.ico">

<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" >
<bal:WixStandardBootstrapperApplication
LicenseFile="..\Some Company\license-agreement.rtf"
LogoFile="..\Some Company\logo_64.png" />
</BootstrapperApplicationRef>

<Chain>
<!-- TODO: Define the list of chained packages. -->
<ExePackage Id="EXE_UsbDriversInstallerExe"
DisplayName="Driver Installer Executable"
Compressed="yes"
Cache="yes"
PerMachine="yes"
Permanent="no"
Vital="yes"
SourceFile="..\Some Company\Drivers-Installer.exe"
InstallCommand="/SILENT=YES"
/>


<!-- More MsiPackages are used in real Bundle.wxs, but they aren't included in this question, because they are working on install and uninstall -->
</Chain>
</Bundle>
</Wix>

这会创建一个 Bundle 安装文件,名为 SomeCompanyBundle.exe

我可以通过命令提示符安装这个包,例如SomeCompanyBundle.exe/quiet/install 即不显示安装 GUI。

我遇到的问题是卸载,这是由于 Drivers-Installer.exe 提供的命令行选项有限(这是来自第三方公司的不存在的旧 installer.exe 文件)

唯一可用的选项是 SILENT=(YES/NO) 或 LANG=(ENGLISH, SPANISH....)。

此 Drivers-Installer.exe 不允许卸载操作。它在 Drivers-Installer.exe 中捆绑了一个 Uninstall.exe 程序,此 Uninstall.exe 仅在成功安装 Drivers-Installer.exe 后可用

Uninstall.exe 安装后始终位于完整路径 c:\Program Files(x 86)\SomeThirdPartyCompany\Drivers-Installed\Uninstall.exe

那么当我使用命令提示符运行 SomeCompanyBundle.exe/quiet/uninstall 时需要卸载 SomeCompanyBundle.exe 时,我该如何运行这个 Uninstall.exe

我尝试过的解决方案是:

1) UninstallCommand="SILENT=YES"---- 由于上述原因,没有工作。

2) CustomAction ----- 对如何在 Bundle 卸载操作上运行 Uninstall.exe 感到困惑。

3) 尝试使用 uil:DirectorySearch 和 util:RegistrySearch。我再次对如何仅在 Bundle 卸载操作上运行 Uninstall.exe 感到困惑。

任何有关示例/解释的帮助将不胜感激。

提前干杯。

最佳答案

这里有一个有趣的方法可以做到这一点。我做了类似的事情,我有一个安装,安装后,在您运行以卸载产品的系统上的某个地方放置一个“uninstall.exe”。

使用 util:FileSearch 查看是否安装了该产品。

<util:FileSearch 
Id="UsbDriversDirSearch"
Path="[ProgramFilesFolder]\SomeThirdPartyCompany\Drivers-Installed\Uninstall.exe"
Result="exists"
Variable="UsbDriversInstalled" />

您还应该添加 DetectCondition="UsbDriversInstalled = 1"到您的 EXE_UsbDriversInstallerExe <ExePackage>这将阻止您尝试双重安装该产品。

创建第二个 <ExePackage> .

<ExePackage
Id="EXE_UsbDriversUninstallerExe"
DetectCondition="NOT WixBundleInstalled OR UsbDriversInstalled = 1"
UninstallCommand="whatever the uninstall command is"
SourceFile="[ProgramFilesFolder]\SomeThirdPartyCompany\Drivers-Installed\Uninstall.exe"
PerMachine="yes"
Cache="no"
Compressed="no" />

所以现在您将始终“安装”Uninstall.exe,并且您可以在卸载 bundle 时卸载此 ExePackage,因为它有一个 UninstallCommand。

关于c# - 使用 Wix 3.8,当卸载程序打包在 exe 安装程序中时,如何使用 Bundle 卸载 ExePackage?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45105902/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com