如何告诉 MSI 升级锁定的 dll 并避免重新启动
我有 MSI 安装程序来安装产品,并且该产品有几个广泛使用的 API dll。 这些 dll 可能会加载到升级过程中我无法控制的进程中(例如,我无法要求用户关闭 explorer.exe 或 svchost)。 因此,在 MSI 升级期间,这些 dll 被锁定,并且在不重新启动的情况下无法升级。我需要使其无需重新启动即可升级。 这些 API dll 非常稳定,当这些 dll 的新版本将加载到新的运行进程中时,让旧副本在旧进程中工作是可以接受的。 因此,当我们不使用 MSI 时,我们只使用标准技巧 - 重命名文件,将其标记为在重新启动时删除,写入新文件。
在 MSI 中执行此操作的最佳方法是什么? 我应该创建自定义操作来执行此标准技巧吗? 或者也许MSI有更好的方法来做到这一点?
谢谢你!
I have MSI installer which installs product and this product has several widely used API dll's.
These dll's may be loaded into processes that I cannot control during upgrade (for instance, I cannot ask user to close explorer.exe or svchost).
So, during MSI upgrade these dll's are locked and cannot be upgraded without reboot. I need to make it upgradeable without reboot.
These API dll's are very stable and it is acceptable to leave old copies working in old processes when new versions of these dll's will be loaded into new running processes.
So, when we didn't use MSI then we just used standard trick - rename file, mark it to delete on reboot, write new file.
What is the best way how to do it in MSI?
Should I create custom action which will do this standard trick?
Or maybe MSI has some better way to do it?
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这些进程被“锁定”,因为它们正在使用中,并且您无法在可执行文件运行时更改它;没有“解锁”,而是停止使用该文件。因此,要么立即终止进程,要么在重新启动后使用 PendingFileRename 键更改文件...
您也许可以尝试终止 explorer.exe 等必须保留 DLL 的句柄/线程(使用自定义操作) ,这可能会工作一分钟...但这将确保(a)您新升级的 DLL 直到重新启动后才能工作,并且(b)您可能使用户的计算机不稳定并且资源管理器可能会崩溃任何时刻。无论哪种方式,最终用户都不会对您的软件感到满意......一定比他们因不得不重新启动而恼火更糟糕。
The processes are "locked" because they're in-use, and you can't change an executable file while it's running; there is no "unlock" but to stop using the file. So either you kill the processes now or use the PendingFileRename key to change the file after a reboot...
You could perhaps try to kill the handles/threads that explorer.exe et al have to hold onto your DLLs (using a custom action), which might work for a minute... but that would ensure that (a) your newly upgraded DLLs won't work until after a restart either, and (b) you've probably made the user's computer unstable and Explorer could crash at any moment. Either way, the end users would not be pleased with your software... must worse than they would be annoyed at having to reboot.