我创建了一个 Visual studio 安装项目,并且为我的主应用程序创建了一个安装程序类。在此安装程序类中,我重写了卸载程序功能以清理由我的应用程序创建的额外文件夹。这在 Windows XP 中工作正常,但在 Windows 7 中不行,因为我认为它与 UAC 有关。如何强制我的卸载程序提升权限?
我在另一篇文章中问过这个问题,但我不清楚我的意图。
我找到了这些链接,但我不知道它是否相关:
http://msdn.microsoft.com/en-us/library/aa370852.aspx
http://msdn.microsoft.com/en -us/library/aa370134%28v=VS.85%29.aspx
更新 (11/7/2011)
I发现Orca可以用来修改msi安装应用程序属性,但没有合适的文档(或示例/教程)。以下是我解决此问题所采取的步骤:
- 使用 Orca 打开 appInstal.msi。
- 从左表中单击 customAction
- 将新条目添加到所有行的末尾(通过双击新行)
- 输入 Elevate_Install_Uninstall 作为操作名称,输入 3072 作为类型
- ,输入 ALL 作为目标并将源保留为空
希望这可以帮助某人/
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.
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
UPDATE (11/7/2011)
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:
- open the appInstal.msi with Orca.
- from the Left Tables click on customAction
- add a new entry to the end of all the rows (by double clicking a new row)
- type Elevate_Install_Uninstall for Action names and 3072 for type
- type ALL for target and leave Source empty
Hope this helps someone/
发布评论
评论(3)
我的假设是您创建了一个新的自定义操作,该操作在卸载 MSI 包时执行。要运行提升的自定义操作(无论是在安装还是卸载时),它必须推迟,并且必须标记为noimpersonation 标志。
在 WiX 中,您可以设置
CustomAction
元素的这些属性:执行=“deferred”
和Impersonate=“no”
。就 Windows Installer 而言,您的自定义操作必须设置以下位:
msidbCustomActionTypeInScript
+msidbCustomActionTypeNoImpersonate
;请参阅自定义操作脚本内执行选项。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.
In WiX, you would set these properties of the
CustomAction
element:Execute="deferred"
andImpersonate="no"
.In terms of Windows Installer, your custom action has to have these bits set:
msidbCustomActionTypeInScript
+msidbCustomActionTypeNoImpersonate
; see Custom Action In-Script Execution Options.Vista 的 UAC 与 Windows 7 类似,因此您应该在这里找到一些帮助:
http://www.professionalvisualstudio.com/blog/2007/10/05/enabling-your-application-for-uac-on-vista/
这篇文章详细介绍了如何调整您的应用程序运行时不会遇到 UAC 问题。
它允许您将清单文件添加到您的解决方案中,以确保它在特定权限级别上运行。
Vista's UAC is similar to window's 7's so you should find some help here:
http://www.professionalvisualstudio.com/blog/2007/10/05/enabling-your-application-for-uac-on-vista/
This write up details how to adjust your app to run without running into problems with UAC.
It allows you to add a manifest file to your solution to make sure it runs at a certain level privilege wise.
将这些属性添加到卸载过程中:
Add these attributes to the Uninstall procedure: