如何删除"以管理员身份运行"在C#中的要求 [英] How to remove the "Run as Administrator" requirement in C#

查看:215
本文介绍了如何删除"以管理员身份运行"在C#中的要求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用注册表保存已打开的最后10个文件的程序。有一段时间,我试图将它们保存在本地机器上,而是决定将它们保存在当前用户。在试图让一切工作的过程中,我创建了一个清单,以强制程序以管理员身份运行,我需要更多的都不敢相信。我遇到的问题是,我似乎无法删除的要求。

I have a program that uses the registry to save the last 10 files that have been opened. At one time I was trying to save them in local machine, but instead decided to save them in the current user. During the course of trying to get everything to work I created a manifest to force the program to Run As Administrator, which I don't beleive is required any more. The problem I'm having is I can't seem to remove the requirement.

我....
变更项目属性为创建应用程序没有清单,增加了一个新的项目叫做app.manifest默认为asInvoker和更改的属性使用该清单,改名有文件名清单字的任何文件。

I have.... Changed the project properties to "Create application without a manifest", Added a new item called app.manifest which defaults to asInvoker and changed the properties to use that manifest, renamed any file that has the word manifest in the file name.

这些尝试都没有奏效。该方案仍然以管理员身份运行。我必须失去了一些东西,但我不知道是什么。

None of these attempts worked. The program still is running as an administrator. I must be missing something but I'm not sure what.

下面是在app.manifest

Here are the lines in the app.manifest

  <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
    <requestedExecutionLevel level="asInvoker" uiAccess="false" />
  </requestedPrivileges>



感谢您的帮助!

Thanks for the help!!

加里

推荐答案

看一看在属性文件夹中的文件app.manifest。删除以下行:

Take a look at the app.manifest file in the Properties folder. Remove the following line:

 <requestedExecutionLevel  level="requireAdministrator" uiAccess="false" />

添加以下行,而不是这样的:

Add the following line instead of this:

 <requestedExecutionLevel  level="asInvoker" uiAccess="false" />

如果这没有帮助,首先确保你也从bin\删除清单文件Debug文件夹。简单地从溶液中取出它并没有帮助,因为该文件可能仍然在输出文件夹中。

If this did not help, first make sure that you also removed the manifest file from the bin\Debug folder. Simply removing it from the solution does not help, because the file might still be available in the output folder.

这就是为什么我认为你不应该从删除清单文件项目,但改变它,它工作正常。

That's why I think you should not remove the manifest file from the project, but change it that it works as expected.

这篇关于如何删除&QUOT;以管理员身份运行&QUOT;在C#中的要求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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