如何使用 Visual Stuio 2010 禁用 UAC?
如何使用 Visual Studio 2010 禁用 UAC 来运行已编译的应用程序而不会出现问题且无需使用虚拟化?
我的意思是以管理员身份运行该应用程序。 (带有盾牌图标)
How to diable UAC using Visual Studio 2010 to run the compiled app without problems and witout using virtualization?
I mean run the app as administrator. (with shield icon)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要添加应用程序清单向您的应用程序指示操作系统它需要管理员权限。这将导致您的应用程序每次启动时都会提示 UAC 提升(无论它是否从 Visual Studio 启动)。
请注意,无法从不以管理员身份运行的应用程序中调试以管理权限运行的应用程序。这意味着如果您想调试应用程序,您还必须以管理员身份运行 Visual Studio。
就我个人而言,我建议您在应用程序中不需要管理员权限,而是使用标记为管理员的进程外 COM 对象来执行管理任务。这样,您的应用就可以将大部分时间作为非管理员,并且仅在实际需要时进行提升。 请参阅此处了解有关的详细信息那。
You need to add an application manifest to your application to indicate to the operating system that it requires administrator privileges. This will cause your application to prompt for UAC elevation every time it's launched (regardless of whether it's launched from Visual Studio or not).
Be aware that applications running with Administrative privileges cannot be debugged from applications that are not running as Administrator. Meaning if you want to debug your application, you'll also have to run Visual Studio as Administrator.
Personally, I would suggest that you don't require Administrator privileges in your application and instead use an out-of-process COM object that is marked as Administrator to perform Administrative tasks. That way, your app can spend most of it's time as a non-Administrator and only elevate when actually required. See here for more information on that.
我认为您不能在每次使用的基础上以编程方式执行此操作。您必须在 Windows 中完全禁用它,或者在 UAC 下升级您的程序。
I don't think you can do this programatically on a per use basis. You must either disable it completley in windows or to upgrade your program work under UAC.