12

What is the recommended User Account Control (UAC) setting when developing on Windows?

Even on Win7 I find it annoying enough to turn it off (because it makes me more productive with it off) but sometimes I feel bad because I know I'll find more problems in my code if I leave it on.

  • "It works on my machine!" The classic response from a developer being told about a problem with his software. This could be due to differences in access rights, hardware resources or installed libraries (and then some). Just try to be aware of possible limitations of a user's machine compared to yours and test if you can before release. Because... "We're not shipping your machine!" – Martin Maat Nov 14 '19 at 21:44

4 Answers4

17

The recommendation (even from Microsoft) is to leave it ON, and also to run your IDE unelevated whenever possible.

First of all, it forces the programmer to live with the same "annoyances" a real world user will have (if you don't know it, would you program correctly around it?).

Then, disabling UAC and working as an administrator is as bad as in Unix to work as root (decades of common wisdom will tell you why that's bad).

Vector Zita
  • 2,442
Wizard79
  • 7,357
  • Running IDE un-elevaetd I can't remember why right now but I had to run it elevated within about 5 minutes of programming. – Brian R. Bondy Sep 03 '10 at 16:01
  • 4
    Windows is not linux, that's not really a good comparison .. – Andreas Bonini Sep 03 '10 at 16:02
  • 9
    @Kop: running with full privileges is either good or bad regardless of the OS... I can't see how Windows and UNIX/Linux are different in that. – Wizard79 Sep 03 '10 at 16:09
  • 1
    @Brian: There are still some libraries that require admin rights (such as developing for Azure), but a vast majority of tasks can be done as non-admin. – Agent_9191 Sep 04 '10 at 07:02
  • You need to run the IDE in elevated mode if you creating Windows Services. – Walter Sep 04 '10 at 12:22
  • @Lorenzo While I agree that running at maximum privileges is never a good idea, I think running as root is much more dangerous than running as Administrator. root has full power in whatever it tries; Administrator is still bound to whatever Windows thinks is right. For instance, you can reformat your hard drive while using it under Linux. Pretty sure Windows will never let you. – zneak Sep 04 '10 at 18:46
  • 2
    @Walter: you can create windows services un-elevated. You need elevated rights to install/uninstall the service though. You should never be installing something directly from the IDE anyways, so an elevated command prompt works better since that's what the IT Pros would end up using. – Agent_9191 Sep 04 '10 at 22:11
  • 2
    @zneak: you are wrong. From a technical point of view being a root user of an Administrator (or elevated admin with UAC) is exactly the same thing. Of course you can't use the format command on the system partition, but this is just a UI choice. You can use a third party program that formats of wipes out the system partition, or anything else. – Wizard79 Sep 04 '10 at 23:46
  • @Kop - Your right, Windows isn't like Linux. Windows users don't keep their OS secure while Linux users do by not running stuff as root. – alternative Sep 23 '10 at 20:20
  • @Lorenzo, well technically, the Windows equivalent of root is the SYSTEM account. But otherwise yes, please don't run as administrator when you don't have to. – Matt Olenik Oct 01 '10 at 17:39
  • Microsoft suggestions aside, the inability to configure IIS (not Express) without elevated privileges shoots this argument in the foot for anyone who wishes to use IIS. – Flater Nov 14 '19 at 15:45
4

Regardless of whether you program with it on or off, you should test your program with a limited user account. This should catch most problems users might have with running your program with a limited account or the UAC turned-on.

Gelatin
  • 2,672
4

I'm running on Windows 7 and I leave UAC on and my account isn't a true admin account. So when I bump into UAC, I have to enter the admin password to continue. Even under Vista I kept it on. I've heard a number of developers say it gets in the way, but I've yet to see that. Under Vista it was a bigger issue as several areas were a little too restrictive.

The question I always bring up when developers say UAC gets in the way is "What are you doing that you keep running into it?". If you are attempting to manipulate files in system folders (Windows, Program Files, IIS sites), you're doing something wrong. IIS websites can exist outside of C:\inetpub. SQL Server user databases can exist outside of Program Files. The only time you should regularly see the UAC prompt is application installs and updates. If you're seeing it more often you're likely working against the system rather than with it.

Agent_9191
  • 1,573
  • 2
    Visual Studio won't let you open an IIS hosted web application project unless it's running elevated. – Heinzi Feb 20 '12 at 07:44
  • To extend @Heinzi's point, if I run two versions of the same application (e.g. two SVN branches which are each stored in a different location), you need VS studio to be able to set IIS to the correct folder that you're working in (i.e. the last solution you opened of these two). Without elevated privileges, not only do you have to update IIS manually, you run the risk of forgetting and testing a completely different version of the application (in the browser) than you're developing (in VS) – Flater Nov 14 '19 at 15:48
1

IMHO, it boils down to what you are doing.

In my current job I dev web apps and windows services. Because of that I find my self more productive with it off. If I was working on apps that a user would install, I would leave it on so I could be as close as possible to what the user would experience.

  • How does leaving UAC off help? Web app development shouldn't require admin rights, except for setting up IIS initially. Windows services would require admin rights to start and stop, but through a single command window and net start/stop you have a single UAC prompt. Otherwise you should have the logic built so you have a command line runner and a Win Service runner. – Agent_9191 Sep 04 '10 at 22:08
  • It doesn't help with development, but it does take away the annoyance of UAC. If you don't need it for simulating low-access turn it off; otherwise leave it on –  Sep 04 '10 at 22:57
  • 2
    Debugging an web app hosted in IIS requires elevated privileges I believe. – FinnNk Oct 02 '11 at 09:10