如何强制 Visual Studio 安装项目生成的 msi 安装程序仅在管理模式下运行? [英] How do I force a Visual Studio setup project generated msi installer to only run in administrative mode?

查看:40
本文介绍了如何强制 Visual Studio 安装项目生成的 msi 安装程序仅在管理模式下运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个生成 msi 安装程序的 Visual Studio 安装项目.如果我以管理员身份运行,安装程序运行良好.如果不是以管理员身份运行,我对 HKEY_CURRENT_USER\Software\Microsoft\Office 的更新将失败.

I have a Visual Studio setup project that generates an msi installer. The installer works fine if I run it as an administrator. If it is not run as an administrator my updates to HKEY_CURRENT_USER\Software\Microsoft\Office fail.

我查看了项目属性中的启动条件、自定义操作和先决条件,但我不知道如何执行此操作.

I have looked at Launch Conditions, Custom Actions and Prerequisites from the project properties but I could not figure out how to do this.

是否可以创建一个安装程序,如果它不是以管理权限运行,则会警告用户并失败?

Is it possible to to create an install that will warn users and fail if it is not run with administrative privileges?

谢谢

推荐答案

设置 ALLUSERS 到 2.

Set ALLUSERS to 2.

您可以使用 Privileged 属性在有条件的自定义操作中向用户显示错误,或者只是在 LaunchCondition 中使用它.如果用户具有管理权限或可以执行提升的安装,则设置 Privileged 属性.

另请参见 AdminUser 属性.

See also AdminUser property.

这篇关于如何强制 Visual Studio 安装项目生成的 msi 安装程序仅在管理模式下运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆