MSI 卸载不会删除程序功能中的产品条目 [英] Msi uninstall does not remove product entry in Program Features

查看:33
本文介绍了MSI 卸载不会删除程序功能中的产品条目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 WiX 3.6 创建一个 msi,它会复制一些 exe 和 dll,安装一些 Windows 服务并添加和删除一些注册表项.

I am using WiX 3.6 to create an msi that copies a few exe's and dll's, installs a number of windows services and adds and deletes a few registry entries.

WiX 非常棒,使用它的内置功能和关联的 .net 托管 dll 中的自定义操作,我已经能够非常轻松地完成我需要的一切.

WiX is brilliant and using it's built in features and custom actions in an associated .net managed dll I have been able to do everything I need to very easily.

不过最近开始出现一个烦人的问题.

One annoying problem has recently started happening though.

安装过程没有出现错误并且完全符合我的预期,但是当我从程序功能"控制面板或命令行卸载时,产品条目仍保留在程序功能"列表中.所有其他文件、服务和文件夹均按预期删除,卸载完成且未报告任何错误!

Installs proceed with no errors and do exactly what I expect, but when I uninstall, either from the Program Features control panel, or from a command line, the product entry remains in the Program Features list. All other files, services and folders are removed as expected, and the uninstall completes with no errors reported!

如果我再次运行卸载程序,程序功能条目将被删除!

If I run the uninstall a second time, the Program Features entry is removed!

我使用了安装和卸载的详细日志记录,并通过平台 SDK 中的 Windows Installer Verbose Log Analyzer 进行了查看,并且没有报告任何错误.

I have used verbose logging of the install and uninstall and viewed both through the Windows Installer Verbose Log Analyzer from the platform SDK, and it reports no errors.

我很困惑!

我确定它之前已正确卸载,但我无法确定我做了什么使其开始表现出这种行为.

I am sure it was uninstalling correctly before, but I cannot identify what I have done to make it start exhibiting this behaviour.

任何想法将不胜感激.

PS 我在 Windows 7 64 位机器上运行,并生成一个 32 位安装程序.

PS I am running on Windows 7 64 bit machine, and generating a 32 bit installer.

PPS 日志太大,无法包含在此处.谁能建议我需要查看哪些条目来控制从程序功能列表中删除条目?

PPS Log is too big to include here. Can anyone advise which entries I need to look at that controls the removal of the entry from the Program Features list?

进一步说明;

我已经检查了下面克里斯托弗回答中的链接,但情况与我的不符.

I had already checked the link from Christopher's answer below, but the situation did not match mine.

第一次卸载后,该条目会从程序功能"列表中消失,但如果刷新或退出控制面板并返回该列表,则会重新出现在列表中.注册表项仍然存在(我已经检查过),所以这就是它仍然出现在列表中的原因.

After the first uninstall, the entry disappears from the Program Features list but reappears in the list if it is refreshed or exit the control panel and come back to it. The registry entry is still present (I have checked) and so this is why it still appears in the list.

第二次卸载会从注册表中删除该条目,因此也会从列表中删除.

The second uninstall removes the entry from the registry, and thus from the list too.

推荐答案

我回顾了我最近对 ​​msi 所做的更改,并发现我所做的更改导致卸载行为异常.

I have retraced the changes I have made to the msi recently and have discovered the change I made that caused the uninstall to behave strangely.

我创建了一个删除一些旧注册表项的功能,我只需要在初始安装时执行此操作,因此我对该功能设置了如下条件;

I created a feature that deletes a few old registry entries, and I only needed to do that during the initial install, so I put a condition on the feature as follows;

<Feature Id="RegistryEntries" Level="0">
        <Condition Level="1">(NOT Installed)</Condition>
        <ComponentRef Id="RegKeysToDelete"/>
</Feature>

如果我没有条件,msi 会按预期安装和卸载.

If I have no condition, the msi installs and uninstalls as expected.

在上述条件下,它可以正确安装并删除注册表项,但卸载时在添加删除程序"中留下了条目,我需要再次卸载才能将其完全删除.

With the above condition, it installs correctly and deletes the registry keys, but the uninstall leaves the entry in Add Remove Programs and I need to uninstall again to remove it fully.

如果我使用以下条件,msi会按预期安装和卸载;

If I use the following condition, the msi installs and uninstalls as expected;

<Feature Id="RegistryEntries" Level="0">
        <Condition Level="1">(NOT Installed) OR REMOVE ~= "ALL"</Condition>
        <ComponentRef Id="RegKeysToDelete"/>
</Feature>

我最初没有考虑卸载,因为我不需要使用这些注册表项在卸载时执行任何操作.虽然这解决了我遇到的问题,但我不明白为什么第一个条件未评估为 1 导致 msi 无法按预期卸载,但我想这是另一个问题...

I didn't cater for the uninstall initially because I don't need to do anything on uninstall with these registry keys. Although this fixes the issue I had, I don't understand why the first condition not evaluating to 1 causes the msi not to uninstall as expected, but I guess that is another question...

请参阅 MSDN 主题 条件表(Windows)(备注部分)

See the MSDN topic Condition Table (Windows) (Remarks Section)

应仔细选择条件,以免功能未启用在安装,然后在卸载时禁用.这将成为孤儿功能,产品将无法卸载.

Conditions should be carefully chosen so that a feature is not enabled on install and then disabled on uninstall. This will orphan the feature and the product will not be able to be uninstalled.

这篇关于MSI 卸载不会删除程序功能中的产品条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆