Category Archives: Visual Studio

Running visual studio as administrator

Running visual studio as administrator is often required, especially if you use IIS as a host for your web site. Therefore, I like it to be started as an administrator by default. So instead of right clicking it and selecting ‘run as administrator’, you can hack it a little bit so that it always starts as administrator, no matter how you start it.

Step 1: change ‘devenv.exe’ compatibility

First go to C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE, right click on ‘devenv.exe’ and select properties, click ‘compatibility tab’, check ‘Run this program as an administrator’, and click ‘OK’:

runasadmin

Step 2: hack VSLauncher.exe

You have to hack VSLauncher.exe a little, because changing its compatibility settings won’t work with visual studio 2010:

  1. Backup C:\Program Files (x86)\Common Files\microsoft shared\MSEnv\VSLauncher.exe
  2. From within a Visual Studio 2010 Tools prompt (run as admin), extract the manifest from VSLauncher.exe:
    mt -inputresource:"VSLauncher.exe" -out:VSLauncher.exe.manifest
  3. Alter the VSLauncher.exe.manifest file:

    <requestedPrivileges>
    <requestedExecutionLevel level="requireAdministrator" uiAccess="false">
    </requestedExecutionLevel>
    </requestedPrivileges>
  4. Write back the manifest into VSLauncher.exe:
    mt -outputresource:VSLauncher.exe -manifest VSLauncher.exe.manifest

If you now start visual studio by its shortcut or by opening a solution file, it will start as an administrator.

Advertisements

Visual Studio 2010 style

The default colors of visual studio are, well, kind of boring. But now it’s possbible to change that with only a few mouse clicks! First go to http://studiostyles.info and download your favorite style. Then, in visual studio 2010, select Tools > Import and Export Settings:

Check the Import selected environment settings, and click Next.

You probably want to save the current settings, so accept the default and click Next.

Then click the Browse button and select the template you downloaded:

…and then the Next button.

Finally click the Finish button.

And if everything was ok:

Click Close, and behold the new style 🙂

Visual Studio 2010 installation

Visual Studio 2010 is out, and of course I installed it right away. During installation, it seemed that someone was getting really jealous 😉

Sort projects alphabetically in Visual Studio

It is a well-known bug in Visual Studio that projects in solution folders are not sorted alphabetically. In solutions with a lot of projects this is often a problem, because it’s kind of hard to find the project you need. So I needed a way to permanently sort projects in solution folders, and it’s actually very easy to do.

Let’s say you have the following visual studio solution:

The project AAA was added after the project ZZZZZZ, so it’s not alphabetically sorted. In order to sort it, right click the ZZZZZZ project and select Rename. Then select another project to end the edit. As you will see, the projects will be sorted:

And then, and this is important, be sure to collapse the solution folders, and then quit and restart Visual Studio. You will then see that the projects remain sorted!