Gotcha – Visual Studio must be run as Administrator in windows 7

This has caught me out a few times.  The first time you experience the problem you will notice that the application which was working fine before suddenly is starting to throw unusual errors when you try to run/debug it.

Windows 7 has an annoying feature where you have to specify applications to run as Administrator.  You can set application to always run as Administrator if you go edit the properties of the shortcut or the exe itself and then go to Advanced and select Run as Administrator.

This is fine if you open Visual Studio using the direct shortcut to the program but what happens if you open a project file?  What happens if the project file uses the Visual Studio version selector.

Yes you have guessed it, one day the application was working fine when I opened Visual studio 2010 and then selected the project from within there.

the next day I was getting unusual errors and after debugging for ages I found that it was because I had opened the project directly, which used the visual studio version program which then choose Visual Studio 2010 but it didn’t run it as Administrator.

I tried changing the properties of Visual Studio program Version Selector but it then wouldn’t open the project at all.

So my advice is when you open any projects or sln files in Visual Studio 2010 on windows 7, open Visual Studio first and then select the project.

3 thoughts on “Gotcha – Visual Studio must be run as Administrator in windows 7

  1. Jamie Miley May 12, 2011 / 4:49 pm

    It all depends on the type of project. Many standard windows apps and things you don’t have to worry about, but WCF on the other hand, yup you absolutely have to.


  2. AdamV May 12, 2011 / 5:57 pm

    I think it’s dangerous to make this a general statement – isn’t this how amateurs end up creating applications which won’t work unless they are run as administrator since that is the only environment they have ever been tested in?
    Fine for things intended for that sort of environment, or running as a service, but be careful that people don’t take the advice out of context


  3. Hosk May 12, 2011 / 7:52 pm

    you are correct maybe all code doesn’t need to be Administrator to run and you make a good point.

    I was just trying to highlight the fact sometimes you do need to be an administrator and if the code isn’t you can then start to experiencing some unusual errors. I was also trying to highlight the fact that the version selector doesn’t run as administrator.

    Thanks for the comments and I think the two commentators are correct, you should probably try and run the code not as Administrator for most projects.


Leave a Reply

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

You are commenting using your 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