Wix 工具集 : complete cleanup after "disallowing uninstallation of component since another client exists"

标签 wix installation windows-installer wix3.8 uninstallation

今天我发现我的安装程序无法再正确卸载。这意味着我的应用程序在从那里卸载后不再显示在控制面板中,但所有文件仍然存在。我查看了日志文件,看到很多“由于存在另一个客户端而不允许卸载组件”,据我所知,这意味着我搞砸了..

那么清理我的电脑并防止将来再次发生这种情况的最佳方法是什么?是什么导致了这种情况?据我所知,我的应用程序的以前版本未完全卸载是导致此错误的原因吗?

不幸的是,由于各种原因无法使用VM..

仅供引用:出于开发和测试目的,我通常使用 1.0.xxxxx 来测试和创建安装程序,其中 xxxxx 通常保持不变。我的升级代码始终相同。此外,我正在使用热量,并且尽可能让 wix 自动生成 GUID。此外,我有一个 CA 用于在安装后显示我的自述文件,还有一个用于执行批处理文件(使用 powercfg 修改注册表项)。卸载后,运行可执行文件以导入 .reg 文件以恢复修改的注册表项(因为它们将被 wix 卸载)。

最佳答案

我们最近遇到这样的情况:我们的一台开发机器在卸载时无法删除所有组件。然而,在其他机器上,WiX 设置按预期工作。

因此,如果您错误地卸载了产品的早期版本并收到消息由于存在另一个客户端而不允许卸载组件:{GUID},那么您很可能存在孤立组件在您的注册表中。

有一个更优雅的解决方案,可以使用 PowerShell 删除这些隐藏注册表项,而不是像其他人提到的那样使用第三方应用程序。

$productName = "Path\\YourProductName"  # this should basically match against your previous
# installation path. Make sure that you don't mess with other components used 
# by any other MSI package

$components = Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\
$count = 0

foreach ($c in $components) 
{
    foreach($p in $c.Property)
    {
        $propValue = (Get-ItemProperty "Registry::$($c.Name)" -Name "$($p)")."$($p)"
        if ($propValue -match $productName) 
        {
            Write-Output $propValue
            $count++
            Remove-Item "Registry::$($c.Name)" -Recurse
        }
    }
}

Write-Host "$($count) key(s) removed"

如果您想获得有关消息禁止卸载...的原因的更详细说明,请查看 here .

关于Wix 工具集 : complete cleanup after "disallowing uninstallation of component since another client exists",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26739524/

相关文章:

visual-studio-2015 - 安装 Visual Studio 2015 时如何使用 AddRemoveFeatures 开关

c++ - Visual Studio 安装程序项目不更新依赖项

卸载时孤立的 WiX 条件功能/组件

python - 如何在 Windows 上安装 PyGI(Python Gobject Introspection)?

installation - WiX 的替代品?

wix - 在 WiX 中的对话框 (InstallUISequence) 之间插入自定义操作

python - pip 安装 channel :"python setup.py egg_info"失败,错误代码 1

deployment - 用于部署 nuget 包的 Wix 安装程序

wix - 错误 LGHT0204 : ICE57: Component has both per-user and per-machine data with a per-machine KeyPath

xcode - 安装 mobileprovision 文件 - Xcode 6