Visual Studio 安装项目:如何强制卸载程序在管理员模式下运行? [英] Visual Studio Setup Project: How Can I force an Uninstaller to run in Administrator mode?
问题描述
我创建了一个 Visual Studio 安装项目,并且为我的主应用创建了一个安装程序类.在这个安装程序类中,我覆盖了卸载程序功能来清理我的应用程序创建的额外文件夹.这在 Windows XP 中运行良好,但在 Windows 7 中不起作用,因为我认为它与 UAC 有关.如何强制卸载程序提升权限?
I've created a Visual studio Setup Project, and I have an Installer Classes created for my main App. In this Installer Class, I overridden the Uninstaller function to clean extra folders created by my app. This works fine in windows XP, but not in Windows 7 since I assume it has something to do with UAC. How Can I force my Uninstaller to elevate privileges?
我在另一篇文章中问过这个问题,但我并不清楚我的意图.
I've asked this question in another post, but I wasn't clear on my intentions.
我找到了这些链接,但我不知道它是否相关:
http://msdn.microsoft.com/en-us/library/aa370852.aspx
http://msdn.microsoft.com/en-us/library/aa370134%28v=VS.85%29.aspx
I've found these links but I don't know if it's relevant:
http://msdn.microsoft.com/en-us/library/aa370852.aspx
http://msdn.microsoft.com/en-us/library/aa370134%28v=VS.85%29.aspx
我发现了 Orca,它可用于修改 msi 安装应用程序的属性,但没有合适的文档(或示例/教程).所以这里是我为解决这个问题而采取的步骤:
I found out about Orca which it can be used to modify the msi install app properties, but there are no proper documentation for it, (or examples/tutorials). So here are the steps I took to fix this issue:
- 使用 Orca 打开 appInstal.msi.
- 从左表点击 customAction
- 在所有行的末尾添加一个新条目(通过双击新行)
- 为操作名称输入 Elevate_Install_Uninstall,为类型输入 3072
- 为目标输入 ALL 并将源留空
希望这对某人有所帮助/
Hope this helps someone/
推荐答案
我假设您创建了一个新的自定义操作,该操作在卸载 MSI 包时执行.要运行提升的自定义操作(安装或卸载时),它必须延迟,并且必须标有 noimpersonation 标志.
My assumption is that you created a new custom action which executed when uninstalling your MSI package. To run a custom action elevated — either on install or on uninstall — it has to be deferred and it has to be marked with noimpersonation flag.
在 WiX 中,您将设置 CustomAction
的这些属性元素:
In WiX, you would set these properties of the CustomAction
element:
Execute="deferred"
和Impersonate="no"
.
就 Windows Installer 而言,您的自定义操作必须设置以下位:msidbCustomActionTypeInScript
+ msidbCustomActionTypeNoImpersonate
;请参阅自定义操作脚本内执行选项.
In terms of Windows Installer, your custom action has to have these bits set: msidbCustomActionTypeInScript
+ msidbCustomActionTypeNoImpersonate
; see Custom Action In-Script Execution Options.
这篇关于Visual Studio 安装项目:如何强制卸载程序在管理员模式下运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!