自定义 VS 2008 安装项目卸载程序
我有一个 .NET 应用程序的安装项目,如果安装/卸载在工作时不受影响,则安装/卸载都可以正常工作。
但是,如果有人在处理过程中取消卸载,则回滚似乎无法正确处理,并且在稍后尝试再次卸载时,用户会收到空引用异常。
我想简化一下情况;我想删除用户取消正在进行的卸载的能力。这可以做到吗?
谢谢, -本
I have a setup project for my .NET application, and both install/uninstall are working just fine, if they are left alone while they work.
However, if someone cancels the uninstall while it is processing, the rollback doesn't seem to be handled correctly, and upon trying to uninstall again at a later time, the user is greeted with a null reference exception.
I would like to just simplify the situation; I would like to remove the user's ability to cancel an uninstall in progress. Can this be done?
Thanks,
-Ben
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,可以这样做。 MSDN 列出了几个选项;但是,仅修补 Visual Studio 创建的 MSI 文件可能会更简单。这可以使用 Orca 来完成(您可以在 Windows SDK 文件夹中找到此工具的安装程序,通常位于 C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\orca.msi 下)。
Orca 允许您编辑 MSI 数据库表。要隐藏取消按钮,您必须向 ControlCondition 表添加一条记录(来自 此处):
使用 Orca 添加记录的手动任务可能最好使用简短的 VBScript 来完成,如下所示:
此脚本可以作为构建后步骤添加到您的安装项目(请注意,输出路径的 Visual Studio 变量中有一个拼写错误):
Yes, it is possible to do so. MSDN lists several options; however, it might be simpler to just patch the MSI file created by Visual Studio. This can be done using Orca (You will find an installer for this tool in the Windows SDK folder typically under C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\orca.msi).
Orca allows you to edit the MSI database tables. To hide the cancel button you would have to add a record to the ControlCondition table (from here):
This manual task of adding a record using Orca is probably better done with a short VBScript like that:
This script can be added as a post-build step to your setup project (Note that there is a typo in the Visual Studio variable for the output path):