Visual Studio 2015 Cheat Sheet

Visual Studio 2015 Cheat SheetI couldn’t find an updated version of the cheat sheet for Visual Studio 2015, so I updated it myself with the new keybindings. I removed the links at the bottom to make more room. There have been several versions of this over the years. Thanks to Phil Price for the version I based this on.

You can download this as an easy to print PDF or an easy to edit Word document.

If I missed your favorite new shortcut, make sure to let me know in the comments to I can update the cheat sheet.

Read more

Switch Visual Studio Settings for Different Solutions

Switching between projects with different formatting styles can be a real pain. I have finally found a solution if you are using Visual Studio and a partial solution for most other platforms.

If you add two configuration files to the root of the solution, they will automatically configure your editor to the coding standards of the solution when you open it and restore your settings to your defaults when you close.

Editor Config

This file defines spacing and tabs for the files in the solution. There are plugins available for pretty much every editor and IDE out there including Visual Studio, Vi, Emacs and even Notepad++.

For more information, got to The Visual Studio extension is on GitHub, and can be installed from the Visual Studio Gallery.


Rebracer sets all of the code formatting rules for the project when you open the solution and restores your defaults when you close. To change the settings you simply need to open edit the Visual Studio options and the changes will automatically be saved out to the Rebracer.xml file.

Rebracer is also on GitHub, and can be installed from the Visual Studio Gallery.

Read more

.NET Application Settings

Application Settings are the recommended way to save state between runs of your program. Long gone are the days of using the registry or INI files to save information. The only problem with Application Settings though is that they tend to disappear whenever you release a new version of your application. Fortunately, it is easy to fix this with some boiler plate code.

First, we need to make sure that our project has a settings file. It is usually under the Properties node of the project. If it is not, right click on the solution and Add | New Item… | Visual C# Items | General | Settings File and name it Settings.settings. Next, drag it and drop it in your project’s Properties folder.

Next, you need to add a bool User setting called UpgradeRequired and default it to true. Next, at the very beginning of your Main, you check if UpgradeRequired is true, and if it is, upgrade the settings, set UpgradeRequired to false and save out the settings. This will pull in the settings from previous versions of your application.

Your settings should look like this,


The code should look like this,

static void Main( string[] args )
   // Upgrade settings if required
   if ( Properties.Settings.Default.UpgradeRequired )
      Properties.Settings.Default.UpgradeRequired = false;

   // Do work...

   // At the end of main, save out any changes to settings

Now you just need to create new settings and use them in your application. Any setting with Application scope will be set in your app.config and will be read-only. This is often used for connection strings and other information that is unlikely to change. User scoped settings also have their default values in app.config, but any changes are written out to an XML file in the user’s AppData folder.

Also, notice that code gets generated for any setting that you create and you access it through a property on Properties.Settings.Default. You can use any complex type for a setting, including classes in your application, as long as they are Serializable.

Read more

Visual Studio 2010 Command Prompt Here

CmdPrompt Real developers live on the command line. Way back in 1996, Microsoft released the Command Prompt Here Power Toy to ease their pain. Industrious developers who preferred the Visual Studio command prompt took it and adopted it to run a Visual Studio command prompt with all of the paths to Visual Studio and .NET tools in the path.

In the fine, time honored tradition, I have continued to update with each new Visual Studio release and have finally done so for Visual Studio 2010.

To install, download, unzip and right click and install the INF file, it will add a “VS 2010 Cmd Prompt Here” menu item when you right click on a folder in Explorer. Clicking on the menu item will launch a DOS prompt in that directory with all of the Visual Studio and .NET paths set correctly.

This assumes that you have installed Visual Studio to the default directory on the C drive. If that is not the case, edit the INF file and change line 38 to the correct path for your installation.

Read more