So you now have installed the new Visual Studio 2012 IDE and you wander what’s new in the IDE that makes it better?
This is the subject of this article. I want to give you my top 10-ish list of the greatest/coolest Visual Studio 2012 IDE new features.
They are presented in random order. Instead of ranking them, I have categorized them by topic.
Some of the features presented here were available in previous versions by using add-ins, 3rd party tools, or hacks. What I will show you here is (mostly) what comes out of the box.
I have created a demo solution this month event if I am only demonstrating IDE features. It does not contain any interesting code.
It just contains some classes and methods definitions to demonstrate some navigation features. You can use any of your own solution if you prefer.
When working in a team, it often happen that some developers will install the newest and greatest IDE but they can’t really start to work with it on the current project until all team members installed it.
For the first time in the whole Visual Studio story, developers of VS2010 and VS2012 can share the same solutions and projects
(as long as VS2012 does not reference any non VS2010 components and does not change the targeted framework). While this is true for most solutions and projects, you will find some exceptions.
Personally, I found that I can’t work with the Crystal Reports designer in VS2012 (SAP didn’t come with a fix for that yet).
Other examples of projects not loading in VS2012 are the VSTO projects, the MSI setup projects, Windows Phone projects, …
If you want to check if your solutions and projects can be shared between IDEs, check Visual Studio 2012 Compatibility.
Speed with large solutions
Solutions now load asynchronously. This is a huge advantage on large solutions.
It doesn’t mean the file you need will load first (and you don’t have the control over what’s get loaded first), but Microsoft spent some time trying to fix a complaint they heard from many developers.
UX in general
When I first launched the new VS2012 IDE, my first reaction was “why is the IDE is yelling at me?”.
When I was at the MVP summit last March, there were a lot of “passionate” discussions about this topic and all the MVPs felt that there were a lot of discussions from within Microsoft.
I was sitting close to Anders Hejlsberg at that time and I saw a funny smile of his face at that time!
You better get used to that “Metro look and feel” (that’s true, I can’t use the M… word anymore,I have to use “Windows 8 style UI”) because all new Microsoft applications comes like this (even Office 2013).
The release version is better then what the beta/preview versions were. Almost everything on the screen (window title, tabs caption, …) used to be uppercase making it very difficult to read.
If you don’t like the all caps menus, you can use a little registry hack to revert this. Follow these 3 little steps:
1. Close Visual Studio
2. Launch regedit and navigate to HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\General
3. Create a DWORD value named SuppressUppercaseConversion with value 1.
Looking at the toolbar, you might observe 2 things. First, there is a lot less bars and icons by default. Microsoft did a lot of clean up keeping the essentials ones and moving many.
Also, instead of having static toolbars, we now have contextual toolbars (much like the ribbons in recent versions of Office).
The content of the main toolbar adjust itself according to the content we are dealing with. It takes a couple of days getting used to it but in the end, you get a better experience.
Second, it appears dimmed or faded. You have to say goodbye to the “Pony rainbow” colors you were used to. Again, it was terrible in the beta/preview version because even the start button was gray.
Following many feedbacks, Microsoft added some colors a couple of icons.
For those of you who worked with designers, you usually see them working with dark tools (because colors are easier to work with in dark themes).
By default, when you first launch VS2012, you have a gray them like we used to had for years.
You can change that Light theme for the Dark theme by opening Tools->Options->Environment->General and changing the color theme as shown in figure 1.
Figure 1: Setting your color theme
If you are using the dark theme, be ready to see some gray zones here and there.
The reason is that Microsoft didn’t revamped all the dialogs of Visual Studio. An example of it is the Project properties still comes in gray.
If you really don’t like neither of these 2 themes,
you can download some more and even create your own by using the Visual Studio 2012 Color Theme Editor.
One other thing I will focus your attention on is the status bar color.
When you open Visual Studio 2012 and no solution or project is loaded, the color of that toolbar is purple. After you loaded a project, it will turn blue. When building your solution, it turns dark blue.
Finally, when running your project from within the IDE (when you hit F5), it turns orange.
The Solution Explorer
The Solution Explorer has many new features that are worth spending some time on them.
To continue exploring other features, you need to create a project. Create any kind you are familiar with.
I have created a solution containing a VB Windows Forms application (yes they still exist) and a C# Windows Forms application.
The Solution Explorer now let you dig into your files more easily by displaying much more content.
One example, is that you will now be able to dig into your types be seeing all the members (as shown in figure 2) much like the Class View was able to show you before but now directly into the Solution Explorer.
You have probably guess that double-clicking any elements will get you to that member in code.
Figure 2: Do we still need the Class View?
Also, by right-clicking any members, you are offered a contextual menu. By clicking the Calls option, you will obtain a list of the members used by the selected one as shown in figure 3.
To get out of that list, you can click either the left arrow or Home on the Solution Explorer’s toolbar. The same contextual menu also let you quickly check where this member is called/used by.
Figure 3: listing the results of the Calls on the Save member
At some point, you will have many documents opened. There is an easy way of filtering the Solution Explorer to display only the active documents.
The fourth icon of Solution Explorer is that toggle. By clicking the little down arrow to the right of that toggle, you can even filter for your pending changes when you are connected to a source control system.
The following icon (shown in figure 4) on the toolbar is very useful when dealing with large solutions. It simply collapse to the project level.
Figure 4: Can you guess what this icon does?
The next icon that is a few features is the Preview Selected Items (as shown in figure 5).
When this feature is on (blue border), as soon as you click a file (or using the arrows of the keyboard) that opens a text editor like a class or the App.Config file,
the file will open in the editor (if the file is already opened, the focus will be given to the correct document). This new feature is well implemented.
If you drill down to the members of the file (like a method of the class), the editor will reposition to that member. If you double-click that member (or press Enter), the focus will be given to that member in the editor.
Figure 5: Preview Selected Items. The blue border means that it the feature is on.
Another new feature of the Solution Explorer I want to cover is called “New Solution Explorer View” and is available when you right-click any items of your solution (down to the members).
What it will do is to launch a new floating Solution Explorer using the currently selected item as the root item of the new instance. Again useful on large solutions.
Even more useful when you are using multiple monitors. We will talk of this feature later in the article when will talk about document management.
Figure 6: New Solution Explorer View
The next new feature is the search feature directly built-in the Solution Explorer.
From anywhere in Visual Studio, you can press CTRL-; to give the focus to the Search Solution Explorer feature (just below the toolbar of the Solution Explorer).
This search feature is worth spending some lines to explain its strength.
Of course you can start typing the name of a file and you will see your Solution Explorer automatically filtering the content to show only what matches the search string.
As you start typing, you quickly discover that not only filenames are used to filter but everything down to the members name (references, classes, methods, properties, …).
You can control (to some extent) the level into which the search will dig by clicking the combo completely to the right of the search line (as shown in figure 7).
If you type your searched characters in lower case, the search will be case insensitive. If you type something like “Cus” (without the quotes), it will search for the exact casing.
Even more, if you type only upper case characters, the search will return anything that contains these uppercase letters in that order.
For example if you type DP and you have a property named customDummyProperty, it will be shown in the results.
Figure 7: Solution Explorer’s search options
I hope you are now convinced that the new Solution Explorer is worth the upgrade alone. But wait, there is more.
Window and Document management
Now enough for the Solution Explorer, there are some great enhancement elsewhere too.
Probably my favorite new feature in this category is the ability to pin some documents. Pinned documents move to the left and they don’t move from there (you can reorder them if you want by doing drag-and-drop).
Multi-monitors owner will be even happier. For a long time now we have been able to take a particular window (a text file for example) and bring it outside the main Visual Studio IDE.
But Visual Studio 2012 brought that feature to the next level. In previous versions, the windows we were taking out of the main IDE became single and floating with no relations whatsoever between them.
Now in Visual Studio 2012, you can take a class file for example, make it float (by either doing a CTRL-DoubleClick on the window name or by right-click the window and select Float)
and then take a second floating window (like the Find Results, a second class) and bring it over the first floating window to dock them together.
Do you remember the “New Solution Explorer View” from the previous category? It now makes a lot of sense to create a new instance of this window.
A little feature long-waited was the “Close All Documents”. We now have it. Now that we can pin documents, we can also do a “Close All But Pinned”.
Another neat innovation in this area is the Preview Tab. In the Solution Explorer, we have seen the “Preview Selected Items” icon that was opening all the documents we were clicking on.
This option can quickly open a lot of documents. Also, when navigating our code, we often use options like “Go To Definition (F12)”. This again opens many documents.
That’s not all. Debugging and stepping into your code opens a heck of documents. Most of these documents are worthless once the debugging is done or once we viewed the definition.
This is exactly why Microsoft created the Preview Tab. All the files I just talked about will open in the text editor but the tab will be on the far right (instead of the left)
and the most beautiful thing is that you only one opened at any single time. This will prevent the windows list from being endless.
If you really want one document to remain open, you can either drag the document to the left, right-click on it and select “Keep Tab Open”, or start editing it.
When the searching using Solution Explorer is not convenient or when searching for commands, there are other ways to look around in VS2012.
The first tool in this category is named “Quick Launch” (as shown in figure 8) and is available from the top right or your IDE (or by pressing CTRL-Q – not to mix with the Windows-Q of Windows 8).
This feature is not to search your code. It is used to search commands of the IDE.
For example, if you want to add a reference and don’t feel like taking your mouse and opening the Project menu to finally select the “Add Reference…” item, you can just press CTRL-Q, type “add ref” and press enter.
You want to change your fonts. Because fonts are appearing as options, you need to type “@opt fonts”.
Figure 8: Quick Launch
Also, many dialogs have been improved with a search feature. The Toolbox, the New Project/File, the Add Reference dialog and the Error List are probably the most useful of these.
These cool new features were for anything but code. Code searching as also been improved.
Now when you hit CTRL-F, you have a little textbox and a couple of options opening in the top right of your code editor as shown in figure 9. The options available right there are “Match case” and “Match whole word”.
Figure 9: Code Searching
By default, the word where your cursor is will be written in the textbox when your hit CTRL-F. As you are used to do, you can press F3 to search the next instance (or SHIFT-F3 for the previous one).
If you need a more complex search, you can open the “Find in Files” dialog by pressing CTRL-SHIFT-F which has been part of Visual Studio since VS2002 if I am not mistaken. But there is something really cool here.
Since the beginning, you could use regular expressions to search your code but the expressions where not standard and no handy help was available.
When you check the “Use Regular Expressions” from that dialog, a small button is enabled. As shown in figure 10, clicking this button opens a very useful dialog showing the most interesting regular expressions.
Figure 10: Using Regular Expressions
You now have no reason to use the richness of the search features to find exactly what you are looking for.
For most people, the upgrade to VS 2012 is a no brainer.
Most solutions can open with any conversion into VS2012 meaning that developers in a team having colleagues still on VS2010 is not a show stopper because they can all share the same solutions files.
What I have listed here are only the tip of the iceberg to make you more productive. And this increased productivity is without installing/buying any additional tools.