Always Run Visual Studio As Administrator

September 27, 2012 — 5 Comments

image When ever you have admin rights to your computer, be sure to run Visual Studio as Administrator. This will greatly reduce the number of headaches cause by tools who don’t react the way you expect them to.

Visual Studio is quirky when it comes to user rights. In some cases, it will misbehave and you might not notice it. One example of this can be observed when you are working with Coded UI Tests (CUIT), when Visual Studio is not running as Administrator, the recorder will not have access to all the control properties that are required. This can quickly lead you to think that the tool isn’t worth much!

Another instance where Visual Studio must be running as Administrator, is when you need to create a website under IIS from within Visual Studio. When it isn’t running under Administrator privileges, it will block you and warn you that you need elevated privileges. This is one of the rare instances where Visual Studio explicitly tells you that you that you are required to start it as an Administrator. This is because IIS requires elevated privileges.

imageThese are but two examples of why it is so important to run Visual Studio as an Administrator.

The image to the right, shows 
how to set
Visual Studio to always start as Administrator. Right click on the shortcut and go into the advanced… menu. Then be sure to check the Run as administrator check box.  

Remember, when ever you have the possibility, it’s best run Visual Studio with full admin rights.

5 responses to Always Run Visual Studio As Administrator

  1. 

    Pretty stupid advice. Why would you want to run any user application as administrator? Just because running as admin is required in your situation doesn’t make it required in others. In almost all situations I explicitly do not want to run as admin to get exceptions for security related issues.

    Is it pretty obvious that you need to run visual studio as administrator when that instance requires administrative access to do non user stuff like your example of IIS. But in almost all situations you do not use IIS to develop web applications and only use IIS to test your deployment.

    So IMHO I think this is bad advice!

    Like

    • 

      ‘But in almost all situations you do not use IIS to develop web applications and only use IIS to test your deployment’

      Not quite true in my experience. A serious application would be having application pool, possibly ADFS or similar certificates based authentication and so on that might need a specific site name. The is specially true when you have the application already in the PROD. IISExpress would not suffice unless someone proves me wrong.

      Having to use admin user might be a different debate.

      Like

  2. 

    Want to update Nuget? You also need administrator rights. I think the issue isn’t about running as Administrator but why Microsoft didn’t say that Coded UI Tests require Admin. Why updating Nuget requires admin… etc…

    In any scenario, Visual Studio doesn’t prompt for elevation when you need it. So in any case, I will always run it as administrator. Mainly because it causes more trouble not to run it as administrator than it does running it without admin rights.

    I trust Visual Studio, ReSharper and all Microsoft extensions that I have. I don’t think they will take over my machine. So admin it is.

    Like

  3. 

    The toughest thing here is you need admin rights to change pretty serious things. Of the answers I’ve seen on StackOverflow, SuperUser etc, they all come down to trust.

    But for the context of this, I’ll go through my arguments on why you shouldn’t do this.

    • Nuget packages auto-update

    Okay, it sounds good. If a 3rd party provider (payment service, hotels etc) updated their API, would you want to know about it? I think its a good thing here, as it can introduce a breaking change and the other 300 people in your development team who depend on your API now have to update theirs too. Note I like this advice from a “be careful here – something might break”.

    For IIS development, you need to start it initially to get the IIS metadata installed and running. Apart from that … nothing needs to change? You might be thinking, “Whoa – I need it because it can’t connect to IIS in user mode!?” … trying running IIS as your user – problem solved. Its development after all.

    My concerns come down to these things:

    Granting local admin rights gives free rein to install absolutely anything

    If you work for a company that needs to monitor its software licensing and someones installed Sublime 3, UltraEdit, TextPad, Notepad++, EditPad, which of these require commercial licenses? Who has the license? Where? I’ve worked somewhere where someone installed Firefox from the “Ad” section of Google. Boom – trojans, malware infections galore. File shares broken and bitcoin miners running as Local System.

    The masses shouldn’t pay the price for the few, but hey – you’ll feel the pain of every file on shares being encrypted by a virus.

    Local admin rights become the norm

    With local admin, after months of it, you become desensitised to your privileges.

    • Hmmm I need Fiddler as I can’t see the JSON
    • Registry key hack there to disable proxies from http://aafe.reg-fixes.net/01313v/reg_fix.reg (and you’ve wiped your web content filtering solution out right there)
    • Quick trial of CCleaner to get rid of that thing .. its licensed but its only a quick fix..
    • Cool! Hijav has a free version .. I’ve heard of that … As I’m only using it for a bit I’ll remember to remove it later
    • Argh I-want-Resharper…. I have a Resharper license at home I can move across
    • dotPeek seems good … and free!
    • Ace! IE12 Preview is out and I can run that in a VM ..
    • Hmm.. I need a VM program – Oracle have a free one too, I’ll get that installed..
    • Sweet – a new browser Torch .. have to try that one and see if our site works
    • AWS have a full SDK that I can try out sometime .. we don’t use it, but I heard someone say something about a cloud … and AWS is a cloud-thing, so I’ll get that installed
    • And I’ll get the Super power admin tools for PowerShell as well

    And then multiply by 300 developers …

    So although I agree that some items are necessary with VS admin mode, which are mitigated through training, do you really need it as a preferred default, when you can just tweak a few settings to solve 80% of the systems and put up with the warnings as and when required.

    If your working on a personal throw away project on your own machine I’d agree, but for commercial / enterprise environment, it just isn’t feasible.

    Like

    • 

      Since this post was written, the Azure teams at Microsoft have released an Express version of the Emulator which does not require elevated privileges.

      I agree without the proper culture the situation you describe.It can get out of hand.

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s