donderdag 12 juni 2008

The pain of development in Vista

I recently bought a new laptop with Windows Vista already pre-installed.  Until that time my development machine was running on XP, but now I had the joy of meeting the latest invention (??) of Microsoft called User Access Control (UAC)!  I am still figuring out if this is supposed to be feature or a bug that the programmers could not fix. 

My problem is the following: Whenever I open a perfectly working solution on my new machine I got an annoying "System.Runtime.InteropServices.COMException" exception hitting me.  I quickly realized it happened only when accessing a Web or Service through IIS.  Whenever you want to access local IIS Website your Visual Studio needs to fired up in the context of an administrator, by default Vista starts applications in a limited-privilege user account.  The solution to this problems is relatively easy, always start your studio in administrator mode.  I created a new shortcut that runs in administrator mode and associated my sln-files to use this shortcut by default.  If you right-click on a shortcut, in the advanced tab you can select the 'run in administrator' option.

Problem solved if you can live with a UAC popup every time you open Visual Studio.  If you anything like me you want to avoid this popup as well :-), my first thought was simply disable the UAC Altogether, but then other features might stop working because windows believes your system is not trustworthy.  Since I usually select proceed in those useless popups I decided to accept this silently without prompting, you can read here how this can be achieved.  I took the liberty of giving you summary here:

Click Start and Control Panel. Switch to Classic View (if you haven't already) and click on the Administration Tools icon. In the list that opens click on Local Security Policy, and in the next window, Local Policies (a tiny bit redundant, but all UIs can't be perfect -- If UAC is running you'll get a UAC pop-up somewhere in here). In the Local Policies list click Security Options, and scroll down to "User Account Control: Behavior" (the full title of the policy is "User Account Control: Behavior of the elevation prompt for administrators in Admin Approval Mode" but the window barely opens that far). Double-click the title and in the dialog box change its setting from "Prompt for Consent" to "Elevate without prompting." Click OK and the urge to tear your hair and scream at your PC will be greatly diminished in the future.

I hope this post will save you time and headache, till next time.

5 opmerkingen:

Anoniem zei

Things like that made me switch to a MacBook Pro. It is so calming to develop on a Mac because you really can focus on the problem only and the system supports you the absolute best it can.


Of course, if you develop .Net or anything like that, I can understand that a Mac is not an option.

kris zei

I was strugling with Vista for over a year trying to develop Java nd .NET applications, about a week ago I have switched back to XP, I had enough of spending half of the time on finding fixes for vista and how to do things 'vista way'. Instead of actually coding you are going to end up fighting with OS which if you are serious developer and not a student is unacceptable. Vista is good os for home but if you are using it for IT releted work, forget about it right now and save yourself huge amounts of precious time.
Regards
Kris

Anoniem zei

Wow. I've been developing Java applications since Vista was a release candidate and have never had problems with it. There has never been any sort of struggle so I'd be interested to know just what you were doing that made you struggle with it for a year. And I also find it odd that you'd wait a year if it were truly a struggle.

I'd consider myself a serious developer and have never had to "fight the OS". What exactly does "fight the OS" mean?

Don't blame the OS....blame the tool vendors for not supporting the OS properly. Java has run fine on Vista for ages so its hard to blame Sun.

The thing that is hilarious is that people would be complaining about security issues with Vista if it weren't for the changes MS made. Have you heard about any serious security issues with Vista since it's release? Thats right...you haven't.

UAC is a more annoying version of OS X or the Linux desktops popping up dialogs asking for administrator rights. The difference is I don't have to type in a password however they do happen more often. If they're that annoying you can disable them completely.

Anoniem zei

Or you could just turn UAC off like most devs do.

UAC was _designed_ to be annoying to pressure software vendors into updating their software to run without requiring admin rights.

UAC prompts so often because A) the software you're running was poorly written (security wise) or B) You're using software that actually needs elevated privileges often (like Visual Studio), in which case just turn it off.

People who switch back to XP drive me insane because it's a classic case of overreaction (the fixes to their issues take 5 minutes).

I've never had any issues with Vista, unless you call being a better OS an issue.

I suppose Microsoft could be like Apple and just crap all over backwards compatibility and the business dev community when they want to move in a different direction.

Patrick zei

I don't like it to turn of UAC. It has it uses as well. Check this site for example (http://4sysops.com/archives/should-you-disable-uac-user-account-control-in-windows-vista/)

That's why I wanted a workaround for my most common concerns. I gave my solution here, but personally I would rather develop on a server OS (Windows Server 2003/Windows Server 2008).