Visual Studio requires elevated permissions in Win

2019-03-24 13:01发布

问题:

I'm running Visual Studio 2008 on Windows 7. When I try to attach to a process, VS tells me to restart under different credentials (with elevated permissions).

So I have to restart VS and run it as Administrator. Is there a way to set it up so VS always starts with Admin privileges?

回答1:

shortcut Properties -> Compatibility tab -> set Run this program as an administrator checkmark.

[]

Shaji in comments posted How to Run a Program as an Administrator in Windows 7 article link.

Most useful(as for me) is to use keyboard shortcut CTRL+Shift while opening the program.



回答2:

Personally (and I don't want to start a religious war on either side here), on any development rig, I always disable UAC. Then, on your test machine, ensure UAC is on and test as normal.

During development, there are an awful lot of tasks which require admin rights, so it's generally easier to just disable UAC.



回答3:

If you always run Visual Studio as an administrator you are going to get the User Access Control warning every time you start it, even if you are logged in as an administrator to Windows. Obviously you can just click ‘OK’ to dismiss this warning, but it may tempt you to turn User Access Control off.

Note that this is true only if Vista’s User Account Control (UAC) is turned on. Many developers turn UAC off, and in this case Vista behaves in the same way as earlier versions of Windows with regard to starting Visual Studio: if you are logged in as an administrator then Visual Studio will by default run with administrative privileges.

The Administrator Account

Vista also has an account called ‘Administrator’ which behaves differently from other administrator accounts. In fact it behaves like administrator accounts in earlier versions of Windows, in that all programs launched when using it run with administrator privileges by default. There’s no need to specifically set up the program as described above.

As a developer your really shouldn’t need to use this account: you can develop with administrator privileges using the techniques described in this article.

However you may have occasions when you aren’t sure whether a program is failing because of some coding error or simply because a process is being launched with insufficient privileges. In these cases it may be useful to use the Administrator account temporarily to simply rule out a problem with privileges. Note that if you work for a large organization they are almost certainly not going to let you near this account, however: this is really only useful for those developing at home.

Using the Administrator Account

To enable the Administrator account start a command prompt with administrator privileges as described above (type ‘cmd’ in the Start Search box and hit Control-Shift-Enter). Then enter:

net user Administrator /active:yes

This has a blank password by default. To set a password use:

net user Administrator {password}

You can now log off and log on as the Administrator. Once you are done with any testing you should disable this account again as below

net user Administrator /active:no

Note that disabling the account does not clear the password. However if you forget it you can always set it again as above when you come to use the account again (provided you have access to at least one account with administrator privileges).

Hope this helps...

s



回答4:

This error occurs because of The current user didn’t have a sufficient privilege to open Visual Studio.

To overcome this issue by right-clicking on visual studio and select run as administrator at every time you intend to open it

Also, you can check the compatibility troubleshooting

  • Right Click on Visual Studio > Select Troubleshoot compatibility.
  • Select Troubleshoot Program.
  • Check The program requires additional permissions.
  • Click on Test the program.
  • Wait for a moment till the program launch.Click Next.
  • Select Yes, save these settings for this program.
  • Wait for resolving the issue.
  • Make sure the final status is fixed.Click Close.

To find the detail steps for How to apply that check this link

https://blog.devoworx.net/2016/01/06/this-task-requires-the-application-to-have-elevated-permissions/

Hope it helps you



回答5:

You only need to elevate VS when you are attaching to an elevated process. Not in general. Always launching VS with elevated permissions sounds like a real drag to me. YMMV I guess.