Wix/MSI:无法卸载
我为一个内部项目开发了一个 Wix 安装程序,但完全是偶然的,我发现我无法在我的开发机器上卸载安装程序,因为我收到以下错误消息:
I've developed a Wix installer for an internal project however entirely by accident I've found that I'm unable to uninstall the installer on my development machine as I get the following error message:
您尝试使用的功能位于不可用的网络资源上
The feature you are trying to use is on a network resource that is unavailable
一个对话框指向我从功能安装的 .msi 的路径.(.msi 在那里,但是已经重建,所以自从我安装它以来已经改变了)
with a dialog pointing to the path of the .msi that I installed from feature from. (The .msi is there, however is has been rebuilt and so has changed since I installed it)
我对此对话框感到担忧,因为我认为 Windows Installer 会跟踪已安装的 .MSI 文件,但是此对话框似乎表明我可以通过删除、移动或更改安装程序来破坏我的卸载程序.
I'm concerned by this dialog as I had believed that Windows Installer kept track of installed .MSI files, however this dialog seems to suggest that I can break my uninstaller by deleting, moving or changing the installer.
是这样吗?
我需要做什么来确保我不会以这种方式破坏我的卸载程序?(我们是否需要保留机器上安装过的所有安装程序版本的副本?)
What do I need to do to make sure that I don't break my uninstaller in this way? (Do we need to keep copies of all versions of the installer ever installed on a machine?)
编写安装程序的第一个痛苦教训之一就是永远不要在自己的机器上运行安装程序.当然,直到它达到成熟点并经历了几个 QA 周期时才会这样做.这就是我们拥有集成实验室和虚拟机的目的.(有句话是说你不应该在自己的后院做的事情.)
One of the first painful lessons of writing installs is to never run your install on your own box. Certainly not until it reaches a point of maturity and has gone through several QA cycles. This is what we have integration labs and virtual machines for. (There is a saying about things you shouldn't do in your own back yard.)
也就是说,通常卸载 MSI 不需要 MSI,但在某些情况下可能需要它.例如,如果在卸载过程中调用 ResolveSource 操作,MSI 将查找 .MSI.
That said, normally an MSI uninstall doesn't require the MSI but there are situations where it could be required. For example if one was to call the ResolveSource action during an uninstall, MSI would then look for the .MSI.
现在有几种方法可以摆脱这个泡菜:
Now there are several ways out of this pickle:
- 获取您拥有的 MSI 并使用 ORCA 对其进行编辑,以匹配您安装的 MSI 的文件名、升级代码、产品代码和包代码.您应该能够通过查看
%WINDIR%\Installer
中存在的剥离缓存 MSI 来获取所有这些信息.CD 到该目录并执行findstr -i -m SOMESTRING *.msi
,其中 SOMESTRING 是独一无二的,例如您的 ProductName 属性.知道缓存的 MSI 的名称后,在 Orca 中打开它以获取所需的属性.然后将这些属性放在您可用的 MSI 副本中并尝试进行卸载.不,这不是您安装的确切 MSI,但通常已经足够接近了.
- Take an MSI you do have and edit it with ORCA to match to file name, UpgradeCode, ProductCode and PackageCode of the MSI that you installed. You should be able to get all of this information from looking at the stripped cached MSI that exists in
%WINDIR%\Installer
. CD to that directory and do afindstr -i -m SOMESTRING *.msi
where SOMESTRING is something unique like your ProductName property. Once you know the name of the cached MSI, open it in Orca to get the required attributes. Then put these attributes in a copy of the MSI you have available and try to do an uninstall. No, it's not the exact MSI that you installed but usually it's close enough.
或
- 使用前端 Windows 安装程序清理实用程序(如果您还有它)和/或后端
MSIZAP
实用程序从 MSI 和 Add/RemovePrograms 中清除应用程序的所有知识.请注意,这实际上并不会卸载程序,因此您还必须编写脚本或以其他方式手动卸载程序的所有痕迹.
- Use the front end windows installer cleanup utility (if you still have it) and/or the backend
MSIZAP
utility to wipe all knowledge of the application from MSI and Add/RemovePrograms. Note, this doesn't actually uninstall the program so you'll have to also write a script or otherwise manually uninstall all traces of the program.
或
- 重新映像您的工作站