Category Archives: Visual Studio

Visual Studio keyboard shortcut to collapse and expand code

Sometimes in Visual Studio you need to collapse all code to give your mind a quick clean and refresh, at least I feel it helps.

The Visual Studio keyboard shortcut to do this is as follows:

Ctrl + M + O for collapse

Ctrl + M + L for expand.

StackOverflow has a very popular question and answer with the shortcuts which leads me to believe that I cannot be alone in my need to occasionally collapse all to preserve my sanity.

AnkhSVN – Subversion Support for Visual Studio

Introduction

In this post I will explain how to install and setup AnkhSVN, subversion support for Visual Studio.

Steps

Download AnkhSVN

Run the installer to install AnkhSVN.

Before you can interact with Subversion directly and comfortably through Visual Studio, you must tell Visual Studio to use AnkhSVN.

To do this, go to:

Tools > Options > Source Control

and select ‘AnkhSVN – Subversion Support for Visual Studio’.

ankhSvn_1

The following Visual Studio window is now visible:

ankhSvn_2

allowing one to see non-commited changes, commit changes, update to receive the most recent changes, etc.

Benefits

Having Subversion integrated into Visual Studio is a productivity boost as opposed to using TortoiseSVN from windows explorer:

ankhSvn_3

NuGet 2.7 Release Candidate

NuGet is a package manager for .NET. It provides an easy way to download and include packages directly from Visual Studio. You can create your own NuGet repository containing any package you may have developed.

Before version 2.7 integrating NuGet with source control was not seamless, you had to jump through some hoops. Namely, you had to enable ‘NuGet Package Restore’ by right-clicking your solution. So when you checked out and built NuGet would automatically download any missing dependencies.

nuget 2.7

If you google ‘nuget auto restore not working’ you will see that many people have trouble setting this up properly. In summary, it takes up valuable time.

NuGet 2.7 enables Package Restore by Default which is great. No more remembering to manually enable it on your Visual Studio solution. This change is very welcome.

vs2013_0

Visual Studio 2013 Preview

Visual Studio 2012 was released Q4 of last year and already we have a replacement; Visual Studio 2013.

Download and Installation

Download

On the page, select ‘Visual Studio Ultimate 2013 Preview’ ‘Install Now’. You download a small 1MB file which downloads and installs the whole IDE. I installed it in a VM of Windows 8.1. It took a while, around 30 minutes.

vs2013_0

When installation is complete you are required to sign into your Microsoft account (or ‘Visual Studio’ account), apparently Visual Studio syncs with other devices (awesome)!

vs2013_1

Next, you choose the theme. I like the new grey Visual Studio 2012 theme but if you prefer you can choose the old Visual Studio 2010 blue theme.

Choose your development environment (C# for me) and click start. The welcome screen looks very familiar:

vs2013_2

There is an update to install as soon as you install the ide.

Reference couting

Let’s start a new Console app. The first change you notice is the reference counting. Each class and method has a little indicator above it telling you how many times it is being referenced.

vs2013_3

When you hover over the reference indicator it shows you where it is being referenced. In the following screenshot, it’s the constructor.

vs2013_4

I now reference the Play class from my main method:

vs2013_5

It’s kinda cool. You can now see, at a glance, which of your classes are heavily referenced and which are not. One could use this tool to focus your unit testing efforts on classes that are relatively heavily referenced.

Return Values Debugging

Return values in the Visual Studio debugger. The Autos window displays return types and values for methods.

(You must start the debugger and hit a breakpoint to be able to see the Auto window.)

vs2013_6

I honestly don’t use the auto window, I probably should. I didn’t know Visual Studio 2012 lacked this feature but it’s nice to now have it. My auto window is now open and I’ll use it when I am debugging.

Edit and Continue for 64-bit apps

Have you ever received the ‘Changed cannot be made to 64-bit applications’ message? I know I have. Apparently Visual Studio 2013 supports this.

Async debugging

Peak Definition and Scrollbar enhancements

I love these two features of Productivity Power Tools. It’s now in Visual Studio natively.

See what else is new or different in Visual Studio 2013

See what else is new in .NET 4.5.1