by Chad
19. March 2009 05:11
I primarily develop in Virtual Machines, but lately I've been doing more work on my Vista boxes. The biggest adjustment is that I can't double-click a .sln file anymore to launch Visual Studio. A solution to this problem occurred to me the other day while working on something totally unrelated.
Why does this happen?
The reason that you can't double-click a solution file with UAC enabled is because the Visual Studio Version Selector won't pass elevated credentials along to Visual Studio when it launches. I could fix this by setting Visual Studio 2008 (as Admin) as the default program for .sln files, but I don't like that because I still have some Visual Studio 2005 solutions.
My workaround
Instead of opening the correct version of Visual Studio (as Admin) and using the Open File dialog box to navigate to my solution folder. I decided to create SendTo shortcuts for both versions of Visual Studio.
- Open %APPDATA%\Microsoft\Windows\SendTo
- Right-click the folder > New > Shortcut
- Browse to the VS2008 .exe (mine was in "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe")
- Click Next
- Enter a name for the shortcut, this is what appears in the SendTo context menu (I entered "VS2008 as Admin")
- Click Next
- Right-click the new shortcut > Properties
- Select the Compatibility tab
- Check 'Run this program as an administrator'
- Click OK
Now you can right-click a .sln file > SentTo > VS2008 as Admin
You can do this same process for Visual Studio 2005 if you use it too, although if you use Visual Studio 2008 exclusively you may just want to change your default program. I hope this helps!