HowTo: Have Visual Studio always run as administrator on Windows 8

In my previous post I wanted my Visual Studio to ‘Run as Administrator’ on my Windows 8 machine. I only managed to get this working for the pinned taskbar icon and not for items in the jumplist or for items you open by double clicking them. The solution to check the box ‘Run as Administrator’ on the compatibility tab of the file properties for devenv.exe was not a solution, because there is no more Compatibility tab in Windows 8 :).
But there is a way to have devenv.exe always ‘Run as Administrator’. Here’s how:

  • Right click devenv.exe en select Troubleshoot compatibility (first picture)
  • Select the option ‘Troubleshoot program’ after the wizard has finished detecting issues
  • Choose the ‘The program requires additional permissions’ option (second picture). The wizard will apply the ‘Run as Administrator’ setting to devenv.exe
  • Click ‘Test the program…’ (third picture – the wizard requires this) and close the wizard
  • Enjoy!


Picture 1  Picture 2  Picture 3

Unable to access the IIS metabase

The Web Application Project SomeWebProject is configured to use IIS.  Unable to access the IIS metabase. You do not have sufficient privilege to access IIS web sites on your machine.I opened a solution in Visual Studio 2012 on my laptop running Windows 8, when I was presented with the error “The Web Application Project SomeWebProject is configured to use IIS.  Unable to access the IIS metabase. You do not have sufficient privilege to access IIS web sites on your machine.” The user I was logged in with was a local administrator and was able to open up and use IIS Manager, but still I was presented with this error. The solution to this is simple: start your Visual Studio with ‘Run as Administrator’. You can do this by right clicking the shortcut and selecting ‘Run as Administrator’.

To always have your Visual Studio open with ‘Run as Administrator’, please follow these steps:
– right click the shortcut you are used to use
– bring up its properties
– click ‘Advanced…’ on the ‘Shortcut’ tab
– check the box ‘Run as administrator’ (see image below)
– close the windows with ‘OK’

Somehow I felt like this was default behavior on my Win7 VS2010 install, but it might be I set up the shortcut for it there too…

Error installing the Windows Azure AppFabric Tools for Visual Studio (CTP)

Windows Server AppFabric is installed and is not compatible with this release of Windows Azure AppFabric Developer Tools for Microsoft Visual Studio 2010 - June 2011 CTP. Please uninstall Windows Server AppFabric and rerun this setup if you want to install Windows Azure AppFabric Developer Tools for Microsoft Visual Studio 2010 - June 2011 CTP.When installing the Windows Azure AppFabric Tools for Visual Studio (found here), you might get the error message shown on the right, stating that Windows Server AppFabric is installed and that it is not compatible with this release of Windows Azure AppFabric Developer Tools for Microsoft Visual Studio 2010 – June 2011 CTP. It asks to uninstall Windows Server AppFabric and rerun this setup if you want to install Windows Azure AppFabric Developer Tools for Microsoft Visual Studio 2010 – June 2011 CTP.

When looking for the install of ‘Windows Server AppFabric’ to remove it through ‘Uninstall a program’ you won’t find this item in the list of installed programs. This might feel as a big problem heading your way…

This is, however, only a small problem on your way to Azure AppFabric development. Go to your list of installed programs and click ‘View installed updates’. Under Windows, you will find the update ‘Windows Server AppFabric (KB970622)’. Uninstall the update, restart your machine and try installing the Windows Azure AppFabric Tools for Visual Studio again…


The Visual Studio 2010 Test Client for WCF services

When writing WCF services, most of us find ourselves writing quick test applications. To give you more time to do what a developer should be doing (adding business value to the project) the Visual Studio team added a WCF test client that can help you reach goals faster.

This is not a very difficult application, but it does the trick and is more than sufficient for simple testing. The WCF Test Client can be found at this location (without the ‘ (x86)’ for x86 machines): C:Program Files (x86)Microsoft Visual Studio 10.0Common7IDE.

Taken from the help:

Windows Communication Foundation (WCF) Test Client (WcfTestClient.exe) is a GUI tool that allows users to input test parameters, submit that input to the service, and view the response that the service sends back. It provides a seamless service testing experience when combined with WCF Service Host.

WCF Test Client screenshots:
image image

Updated: Thanks to Marco for pointing out my typo…!

HowTo: open all files from the Find Results window

Here’s a quick Visual Studio tip for you…

I frequently search for a specific text in my solution because I need to do something in all places where that text occurs. Today I found out how you can open all the files that are mentioned in the Find Results window.

Search for the text you’re looking for. In my case this is ITest*.
Open up the Search Results window and select all the records where the text was found. You can do this by dragging your mouse cursor over the text or clicking the text of the first search result, holding SHIFT and clicking the text of the last.
Search Results for ITest

Right click anywhere on the selected text and choose ‘Go to location’. If you click anywhere other than on selected text, you will lose the selection and you’ll probably get just one file opened. When all files are opened you will keep the ‘Go To Next Location F8’ and ‘Go To Previous Location SHIFT + F8’ functionality. That might be a nice one to loop through all the locations where your text was found. Especially when it was found more than once in one file.

Hope this helps.


* The usefulness of searching for this interface is arbitrary due to functionality as ‘Find all references’ and so on. Luckily I’m only using it for this example. So lets not focus on that but on the tip this post is about ;)

Patches available for scrolling context menu in Visual Studio 2010

The past couple of days I’ve been experiencing some issues with the context menu for my Solution Explorer in Visual Studio 2010. It contained scrollbars even when there was sufficient space on the screen to show the menu without scrolling.

Searching for that issue I immediately found this blog post on The Visual Studio Blog. Taken from that post:

We’re pleased to announce that there are patches available for Visual Studio and Windows Presentation Foundation that fix this problem. You will need to install both patches to fix this issue

  1. Visual Studio 2010 patch:
  2. Windows Presentation Foundation 4.0 patch:
    1. X86: NDP40-KB2413613-x86.exe.
    2. X64: NDP40-KB2413613-x64.exe.

I installed both patches and find Visual Studio no longer shows scrollbars in my context menu when I don’t need ‘em. Next to that I am now able to scroll through the menu (when using scrollbars) by using the mousewheel. I think this didn’t work before the patches, but I can’t test my ‘before’ situation anymore…

Hope this helps.

HowTo: have Visual Studio open XAML documents in code view

Just a small post to start the new year… and let it be a good one!

When opening a XAML document in Visual Studio, it opens in split view by default. This might become annoying when you have a large XAML document, because all the content needs to be rendered before you can get some work done.

Here’s how you can have Visual Studio open XAML documents in code view:

  • Go to Tools, Options
  • Under Text Editor open the XAML section and select Miscellaneous
  • Under Default View check the Always open documents in full XAML view box (see image below)
  • Click OK to apply and you’re all done!

Hope this helps.


Visual Studio: Zero-impact Projects & Cutting/copying empty lines

Yesterday I remembered two Visual Studio options Sara Ford told about in a presentation of her I attended a while back. Changing them made me happy… :)

Zero-impact projects
When I have to test something real quick, I tend to create a new project in Visual Studio and scribble some code to test whatever I want to test at that point. This causes my project directory to be filled with projects named ‘WindowsFormsApplication14’ or something like that. To make this stop, go to Tools – Options – Projects and Solutions – General. Uncheck the option ‘Save new projects when created’. This way those newly made (and shortly used) projects aren’t saved untill you explicitly tell Visual Studio to do so. No more ‘WindowsFormsApplication63’ for you! Unless you want to name it that way intentionally, of course…

Cutting/copying empty lines
We probably all experienced this at one time or another: you select some code, copy it, go to an empty line where you want to past the code…….and you press CTRL + C by accident. With the default settings, you just copied an empty line and have lost the stuff you copied earlier. But with this next option, empty lines won’t get copied or cut anymore! Go to Tools – Options – Text Editor – All languages (or just the language you want to change this setting for) and deselect the option ‘Apply Cut or Copy commands to blank lines when there is no selection’.

Visual Studio 2010: Close all documents

Sometimes it’s the little things that make you love a new product just a bit more.

I tend to close stuff I don’t use anymore fairly quickly. Sometimes I even close an Explorer window or an application right after I used it, only to find I need it again in a few moments… We all have our quirks, right ;)

While developing I regularly close all the documents I have open in Visual Studio, especially when I am done with a specific task. And most of the time, I like to collapse all the projects and their subfolders too to keep a tidy work environment. I also have the option ‘Track Active Item in Solution Explorer’ checked under ‘Tools’ – ‘Options’ – ‘Projects and solutions’ – ‘General’. Of course I have, I’d almost add…

In older versions of Visual Studio (while having the ‘Track Active Item in Solution Explorer’ option turned on) choosing the ‘Close all documents’ item in the ‘Windows’ menu after having collapsed all the projects lead to one project opening up again. That was the project with the document that was active just before closing all the documents. The ‘Track Active Item in Solution Explorer’ option seemed to squeeze in a ‘Look at that guy!’ just before all the documents actually closed, making Visual Studio open up the project and highlighting the file again. Although I knew this happened, I somehow kept to my usual routine of collapsing all the projects and their subfolders before closing all documents, with the same result each time: me closing that one project (or those seven subfolders) twice.

But…… no more in Visual Studio 2010! This newly built IDE seems to understand my way of work: no longer does Visual Studio (or the ‘Track Active Item in Solution Explorer option) open up the project of an active item when I choose ‘Close All Documents’. I’m not even sure if this was a specific choice or just a coincidental side-effect of the new IDE, but it makes me love Visual Studio 2010 just a bit more… :)

Visual Studio 2010 and the web.config

While working with Visual Studio 2010, a new feature caught my eye that isn’t communicated (strongly) in the “What’s new” lists you can find online. As part of the Visual Studio 2010 supports  multiple web.config files! Now we can create a separate web.config file for each configuration we have for our application. If you add a configuration through the configuration manager, you have the possibility to add a web.config file  for the new configuration too.

A web application gets two configurations by default: a Debug and a Release configuration. When opening the plus sign in front of the web.config file, two extra files appear: web.debug.config and web.release.config.  Depending on the active configuration, Visual Stusio selects the correct version.

The web.config file contains the default configuration. Configuration specific config files may add or remove settings or change current ones. This is done using simple transformation tags.

For more information on transformations have a look at: