In-Depth

Inside Visual Studio 11: A Guided Tour

Visual Studio 11 is packed with new features to help you be a more efficient, productive developer. Here's your guided tour.

By the time you read this, Visual Studio 11 beta 1 will be available for download. In this article, I'll review what Visual Studio 11 has in store for developers from an IDE perspective. Specifically, the focus is on new tooling included that's centered around productivity. Discussions of features such as language changes, Microsoft .NET Framework additions and Metro-style development capabilities will be covered in future articles.



Much of what's in the Visual Studio 11 IDE has been available for some time already in the form of Power Tools extensions to Visual Studio 2010. However, through Visual Studio 11, those extensions are built-in, eliminating the bother of installing and updating each one of those extensions. More importantly, by building the extension functionality directly into the product, the integration is much deeper and cleaner.


More articles on Visual Studio 11:


Of course, Visual Studio 11 features don't just stop with integrated Power Tools. The following list provides an overview:

  • Project Compatibility
  • IDE Productivity Improvements
  • Search Everywhere
  • Toolbar Improvements
  • Additional Tooling
  • Multiple-Monitor Support
  • Performance Enhancements
  • New Project Types
  • Extensibility

The rest of the article delves into the details of each of these improvements.

Project Compatibility
Discussion of installation and side-by-side development would normally be left until the end, but project compatibility in Visual Studio 11 makes upgrading to the new IDE so simple it's hard to ignore. In the past, each release of Visual Studio modified the project files, sometimes only with a version number update. As a result, it became difficult for individual developers within a team to begin development with a newer version of Visual Studio without a plan for the entire team to upgrade as well.

In contrast, Visual Studio 11 includes project compatibility as a specific feature, such that there's no project upgrade step. The key is that the project files created by Visual Studio 2010 remain the same after opening in Visual Studio 11. The result is that if one programmer within a team opens up a Visual Studio 2010 project using Visual Studio 11 and then checks-in the shared code after making changes, other developers on the same team can open up the same project using Visual Studio 2010 SP1 without any ramifications. Furthermore, developers that create projects with Visual Studio 11 can share with developers running Visual Studio 2010 SP1, as long as they target a supported .NET Framework version. This is significant because it means upgrading doesn't have to have a big impact on the entire team. Rather, the team can transition gradually as the upgrade is proved out by a subset of the development team.

Note: Visual Studio 11 Project Compatibility only works with Visual Studio 2010 SP1; without the service pack, you'll be prompted to convert the project.

IDE Productivity Improvements
There's a set of IDE productivity improvements that developers across all platforms and languages will notice. Many of these enhancements will be familiar to some because earlier versions of them were available in an update for Visual Studio 2010 under the name Productivity Power Tools.

To start with, the Solution Explorer has been revamped significantly. No longer is it just a location to navigate files; it now supports navigation over the object model of constructs within the solution, full-text identifier search and more. For example, you can now expand a CS file to see nodes corresponding to the classes within the file and then expand the class further to view its members (see Figure 1). This is similar to what's available in the Visual Studio 2010 object explorer.


[Click on image for larger view.]
Figure 1. The Visual Studio 11 Solution Explorer display.

Right-clicking on a class member displays a context menu for browsing the call hierarchy of the member (see the context menu in Figure 1). Similarly, right-clicking on a class displays a Contains, Base Types, Derived Types and Is Used By context menu for additional call structure exploration. In both cases, the New View button appears, allowing a new view focused on the selected item to open. In addition to the call hierarchy context menu, and as one would expect, double-clicking on the node will launch you to the definition of that construct or open up the file corresponding to it.

With this enhanced Solution Explorer comes an additional Windows Preview option as well. Clicking on a node in Solution Explorer opens up a document in preview mode. This option reserves a reusable document tab in the IDE such that each time a file is opened, it appears in the same document tab as the previously opened documents. The result is that you can preview files without opening myriad unneeded document tabs. The document tab can then be Promoted through a button glyph (see Figure 2) on the tab itself or automatically when the file is edited.


[Click on image for larger view.]
Figure 2. Promoting a tab from Preview mode.

Where the preview tab really cleans up the IDE is during debugging or Go To Definition (F12), where windows will otherwise proliferate. Instead, the same tab window is recycled for all the documents you preview while debugging or browsing through the code.

A similar feature to the preview tab is "tab pinning." In place of the "Promote" button found on the Preview Tab (Figure 2), normal tabs have a pin icon that moves the tab to the left of the tab well. Any new documents that are opened will appear to the right of the last pinned tab, effectively holding the position of the pinned tabs unless they're deliberately moved.

There are several additional Solution Explorer-related features of which to be aware. First, it's no longer necessary to open up a graphics file (.jpg, .png and so on) to glimpse it. Instead, Visual Studio 11 supports hovering over the file within Solution Explorer, triggering a dynamic preview image of the graphic. Second, when renaming files in the Solution Explorer, it now behaves like Windows Explorer. The default selected text after issuing a rename action is the file name but not the extension.

Search Everywhere
Another feature you'll wonder how you managed without -- or perhaps you wondered why it was missing from Visual Studio for so long -- is the concept of "Search Everywhere." In Visual Studio 11 search is now supported for the following features (similar search functionality exists within the Productivity Power Tools in Visual Studio 2010 for the first three features):

  • Solution Explorer
  • Add Reference
  • Integrated Quick Find
  • New Test Explorer
  • Error List
  • Parallel Watch
  • Toolbox
  • Team Foundation Server (TFS) Work Items
  • Visual Studio Commands

Let's take a look at each search location in more detail.

Solution Explorer
Perhaps the most noticeable manifestation of Search Everywhere appears within the Solution Explorer. As shown both in Figure 1 and again in Figure 3, there's a Search Solution Explorer textbox (Ctrl+;) that searches the solution and produces a search results window of matching Solution Explorer available nodes.


[Click on image for larger view.]
Figure 3. The Visual Studio 11 toolbar.

The results window displays such assets as projects, files and identifiers -- classes and class member names. The result is similar in behavior to Visual Studio 2010 Navigate To (Ctrl+,) functionality, but rather than a modal dialog, the Search Solution Explorer produces a search results window that's integrated into the IDE. Like Navigate To, the Search Solution Explorer supports "fuzzy search" -- entering the first (uppercase) letters of each word within an identifier will still locate the corresponding node. For example, entering "MOCT" will display all instances of MockObjectContextTests, but "moct" will not. Note that the keyboard shortcut (Ctrl+;) switches focus to the search box even when the Solution Explorer isn't visible. This is a handy shortcut when Solution Explorer is closed.

Add Reference
Another instance of Search Everywhere occurs within the new Add Reference Dialog. In Visual Studio 11 (as with the Productivity Power Tools), when opening the Add Reference Dialog there's a search box on the top right of the dialog.

The dialog still places the target reference into categories -- Assemblies, Solution and COM -- but the experience of looking for a particular reference is significantly improved. Possibly more noticeable than the Add Reference search is how quickly the Add Reference dialog opens. Rather than seemingly enumerating the Global Assembly Cache and every COM object installed on the computer, the new dialog uses an index (of the installed components) and displays almost instantly.

Double-clicking on any item selects it, and all referenced items are displayed with a checkmark next to the assembly name.

Integrated Quick Find
While on the topic of search, another significant productivity improvement is a streamlined Find UI design, called Quick Find. Leveraging again the UI of Productivity Power Tools, the Visual Studio 11 Find (Ctrl+F) and Find-Replace (Ctrl+H) functionality is integrated into the text editor window rather than a new pop-up window (see Figure 5,). The result is that the Find and Find-Replace functionality remains in context.


[Click on image for larger view.]
Figure 5. Streamlined Find-Replace behavior.

Furthermore, the text entered in the Find box is immediately highlighted throughout all text editor windows, including the currently active document, other open document windows and any newly opened document windows. To change the search scope, you can select from the dropdown available below the Replace textbox. Figure 5 shows the advanced search options that are available after clicking the "Expand" button directly to the left of the Find textbox. For developers looking for the Use Regular Expression, Match Whole Words and Match Case functionality in addition to the Find in Files capability (something no longer available in the toolbar, as will be discussed shortly), there's a dropdown on the textbox that not only displays recent search terms, but also the additional search options.

New Test Explorer
Another manifestation of Search Everywhere is in the new Unit Test Explorer window. Unit testing in Visual Studio 11 was overhauled and includes support for third-party testing frameworks along with a consolidation of the testing windows into the new Unit Test Explorer window. The top of the new Unit Test Explorer window includes a search textbox, enabling search for a particular test.

In addition to search, the new Unit Test Explorer includes the following functionality:

  • Continuous Testing. Immediately following a compile, the unit testing is automatically triggered to run (in a separate process so as not to impact the IDE responsiveness). As a result, executing tests is no longer a separate action but rather something automatically part of the development process. It's similar to the way that syntax checking happens automatically as you write code. If there are failing tests, only the failing ones will be executed as part of the continuous testing. The idea behind this is to get the failing ones passing before executing any additional tests.
  • Execution within a different process. In Visual Studio 2010, the IDE was essentially blocked while unit tests executed. In contrast, unit test execution within Visual Studio 11 runs concurrently with any IDE activity the developer might be working on. This is due to the fact that in Visual Studio 11 the unit tests are asynchronously shelled out to a separate process.
  • Support for different unit-testing frameworks. As mentioned, the Visual Studio 11 unit-testing framework support is extensible. As a result, unit tests from other frameworks also appear within the new Unit Test Explore window.
  • Sorting by relevance. Unit tests within the Unit Test Explorer windows are sorted by relevance. Failed tests bubble to the top. Tests executed more recently appear before tests that weren't run in the previous test execution.
  • Execution time displayed. The time it took to execute a unit test appears next to each unit test.
  • Mocks/stub support. In Visual Studio 11 there's support for the generation of mocks/stubs of a class. This is integrated not only into the framework, but all the way into the IDE tooling via "right-click generate mock/stub" contextual menus.

Those committed to unit testing will find the revamped functionality within Visual Studio 11 to be compelling to the point that this feature set alone will make it difficult to return to Visual Studio 2010.

Error List
Yet another Search Everywhere location occurs in the Error List (see Figure 6).

By using the Search Error List textbox, you can search across columns and all errors within the error list to focus on the errors you wish to address first. Furthermore, Visual Studio 11 supports a filter so that developers are no longer overwhelmed by innocuous HTML warnings -- while investigating C# code, for example. Instead, using the filter button, developers can select the scope of warnings to be displayed.


[Click on image for larger view.]
Figure 6. Search and Filter are now supported in the Error List.

Parallel Watch
The Parallel Watch window is another area where search appears in Visual Studio 11. Although not really a textual search, these watch windows include a Filter by Boolean expression search box. This enables filtering across different threads and evaluation of the expression for each thread to determine which threads evaluate the expression to true.

TFS Work Items
An additional instance of Search Everywhere corresponds to TFS integration. The Visual Studio 11 Team Explorer window is completely redesigned, and now includes a Search Work Items textbox to search across work items.

Visual Studio Commands
The last Search Everywhere feature discussed in this article appears in the Visual Studio 11 toolbar, and enables search over all the available commands and actions within Visual Studio 11 itself. We explore this feature as part of Toolbar Improvements.

Toolbar Improvements
The new Quick Launch (Ctrl+`) search box (also referred to as the Quick Access Toolbar) provides search across the available Visual Studio 11 commands (Figure 3). Typing within this textbox filters out a list of available Visual Studio commands that can then be activated from within the dropdown. This enables an easily discoverable and keyboard-accessible mechanism for quickly navigating and activating the myriad commands buried within Visual Studio.

Unlike the former Command Window approach to achieving this, the Quick Access Toolbar's search is broader and its results list is significantly more readable. Furthermore, it includes items within tools options. Entering "Preview," for example, will display an item for "Environment -> Tabs and Windows," and selecting that item will display the dialog from which you can turn off the window preview functionality. For commands that are less frequently accessed, there's a "most recently used" list located at the top of the results list. Similarly, Quick Launch searches across open tabs, allowing you to jump to a particular document when there are possibly multiple open documents within the solution.

One great feature in particular about the Quick Access Toolbar is that keyboard shortcuts are shown in the results window. With previous versions of Visual Studio, I repeatedly found myself opening up the Keyboard Options window to access the "Show command containing" search functionality to find a keyboard shortcut. In Visual Studio 11, this capability is directly and immediately accessible within a single keyboard shortcut.

Another productivity improvement in Visual Studio 11 appears in the toolbar itself. You'll notice the toolbar is only one layer of buttons out of the box. (The double row of menus is caused by reducing the IDE window size in order to keep the image size small.) Following a review of usage statistics, the Visual Studio team confirmed that developers seldom use buttons like Cut, Copy and Paste, for example, and seldom save only the currently active document rather than all open documents.

The end result was a simplified toolbar with only the most common actions. Part of what enables a reduction like this to be successful goes back to the Quick Access Toolbar and the ability for developers to leverage that for the buttons they might otherwise miss. If you want to restore a particular button to a prominent position, it's easily available. As Figure 7 demonstrates, there's an "overflow" button on each toolbar from which you can quickly add and remove buttons so that they appear once more.


[Click on image for larger view.]
Figure 7. Easily add or remove buttons in Visual Studio 11.

When upgrading from Visual Studio 2010, any toolbar customizations from that version will persist within the Visual Studio 11 IDE.

Notice the Solution Explorer toolbar includes some changes, too. There are a few new button additions, including a Collapse All button for collapsing all the nodes within a solution so that only the project level is shown. The New View button produces a floating replica of the solution window that can be placed onto an alternate monitor.

Additional Tooling
Several tools are new to Visual Studio 11. Perhaps most notably, Expression Blend will be integrated into the Visual Studio 11 IDE. The plan is for this to be available for all XAML-based development, as you'd expect. I'll leave an in-depth discussion of Expression Blend integration for another time.

Those readers who have been developing within Visual Studio since Source Safe will recall that the Visual Studio 2010 file-differencing utility bundled with Visual Studio was the same one that accompanied Visual Source Safe (which is more than 10 years old). Visual Studio 11 changes that, adding a brand-new differencing utility with all the expected features (Figure 4).


[Click on image for larger view.]
Figure 4. Visual Studio 11 includes a new file-differencing utility.

The new functionality includes several different modes, including the side-by-side view, Inline mode, and Left or Right file-only modes. In addition, there are options for whether to synchronize the two views and whether to include trim white space.

Perhaps one of the key features of file differencing is that it's semantically enabled, meaning it supports IntelliSense right from within the differencing windows. This makes editing of files while performing a difference significantly more powerful. Furthermore, the file-differencing window is incorporated into the code-review functionality of TFS. As a result, code reviews automatically show the difference between the current and previous version of a file. Comments during the code review can be overlaid on top of the files themselves. The result is that comments are integrated directly into the code editor, but don't necessarily have to impact the code itself.

Multiple-Monitor Support
Although Visual Studio 2010 made some advances in multiple-monitor support, it wasn't without frustration. I tend to develop with Visual Studio maximized on one monitor and a browser and/or e-mail open on a second. As more and more files open, I spread Visual Studio out to a second window. Unfortunately, once I start expanding Visual Studio, it's no longer possible to view the browser/e-mail simultaneously while using Visual Studio. Instead, Visual Studio 2010 trumps the other applications and pulls its windows to the forefront, obscuring other applications in the process. Furthermore, it isn't possible to set up a second window of Visual Studio documents on the second monitor. Rather, each tab dragged to the second monitor is a floating window that obscures other Visual Studio windows -- but does so without the ability to click within a tab well and select a different tab.

Visual Studio 11 has superior multiple-monitor support. It mimics the behavior of recent versions of Internet Explorer 8 and beyond such that dragging a window to the second monitor creates a document container window -- a new IDE window -- into which more documents can be dragged (or removed). Given the button on Solution Explorer for creating a duplicate of the Solution Explorer window , it's even possible to populate the second document container with its own Solution Explorer. Window placement is saved, so if you close and reopen a solution, the windows are restored to the position they were in before the window was closed.

Performance Enhancements
Visual Studio 2010 included an option for "maximum number of parallel project builds." Although there was no indication of any restriction, this IDE option only worked for C++ projects. Fortunately, this restriction no longer applies to Visual Studio 11. Rather, there's now full support for parallel builds in other languages as well. To view this, run a copy of Process Explorer at the same time a solution with numerous projects is building. You'll see that multiple MSBuild instances are created -- as many as specified in the "maximum number of parallel project builds."

The fact that Visual Studio 11 is shelling out to msbuild.exe for the actual build process itself is a difference from Visual Studio 2010. Rather than the builds executing within the Devenv.exe process -- resulting in an increased memory footprint and an unresponsive UI while building -- Visual Studio 11 is able to keep its memory footprint low and the UI responsive. The importance of the low memory footprint is especially significant in that it reduces the need for Visual Studio to run as a 64-bit process -- something not available this release.

Parenthetically: Generally, it wouldn't be necessary to change the maximum-number-of-parallel-project-builds value, as it defaults to the number of CPUs available. However, there's a possibility that there are dependencies between projects that haven't been correctly identified in the solution project configuration properties. This can lead to inconsistent behavior because files are being simultaneously accessed by two different builds, or because they end up not being built in the correct order. Even if such a problem occurs, changing the maximum value should be avoided in favor of correcting the project dependency tree within the solution. Otherwise, you end up forcing the restriction on all solutions or having to modify the value for each different solution loaded within Visual Studio.

New Project Types
One of the first things I do whenever I begin working with a new version of Visual Studio is review the different project types and compare them to what was previously available. This provides insight into technology direction changes as Microsoft moves from one platform to another. For example, are Windows Forms projects still supported? What about Silverlight? Are there any new project types that indicate a shift in direction? Toward this end, I compiled a list of the differences between Visual Studio 2010 and Visual Studio 11.

Not surprisingly, the Windows Metro-style category of projects is where the majority of new project types appear. This includes Application, Grid Application, Split Application, Class Library and Unit Test Library. Another category that's particular to Visual Studio 11 is JavaScript, and includes Blank Application, Fixed Layout Application, Grid Application, Navigation Application and Split Application. Both of these categories are only available when installing Visual Studio 11 onto a Windows 8 computer. Metro applications run under the Windows Runtime (WinRT), and devel¬opment is available in the entire range of Visual Studio languages: C#/Visual Basic, C++ and even JavaScript.

Even without Metro applications, there are still noticeable differences in Visual Studio 11 project types between what was available before, and from this comparison we can infer several reasonable conclusions. One is that Windows Forms is alive for at least one more release. Next, Silverlight is available, indicating it continues to be a supported platform out of the box in Visual Studio 11. This includes support as an entire self-contained application, running within a Web page, or within SharePoint. Notice the inclusion of the Portable Class Library project type as well. This enables cross-platform development of class libraries that work under Silverlight and the standard .NET Framework.

SharePoint 2010 itself also has strong representation along with the rest of the Microsoft Office 2010 suite, including not only Word and Excel but also Outlook, InfoPath and even Visio. In fact, the only difference is the lack of Office 2007 and SharePoint 2007 project templates.

Another area with very strong representation is the suite of projects available through C++. This includes not only the well-¬established unmanaged set of project types, but even support for Metro development in C++.

Finally, note the .NET Framework versions supported. In this regard, Visual Studio 11 supports compilation against .NET versions as far back as the .NET Framework 2.0. There are many project templates that will disappear from the dialog if you specify a .NET Framework version that's (relatively) old.

Extensibility
Extensibility is one more category with significant differences. To streamline the path to creating extensions, Visual Studio 11 supports a plethora of new project templates targeting Visual Studio extensibility, as follows:

  • Visual Studio Package: Earlier-style Visual Studio plug-ins
  • C#/Visual Basic Item and Project Templates: Custom document and project templates
  • Editor Classifier: Custom syntax highlighting support
  • Editor Margin: Supports custom "margins" UI within the editor window
  • Editor Text Adornment: Supports custom graphics (adornments) relative to the editor text
  • Editor Viewport Adornment: Supports custom graphics relative to the editor canvas
  • VSIX Project: Visual Studio extensions distributed through Visual Studio Gallery
  • Windows Presentation Foundation/Windows Forms Toolbox Control: Custom controls for the Windows client UI

In addition, Visual Studio 11 includes specific APIs for extending the functionality in new areas not previously supported. As mentioned earlier, this includes support for third-party unit testing harnesses (XUnit and NUnit, for example), as well as custom code-analysis engines. This is a significant move on Microsoft's part that's likely to enable IDE extensions, especially in the area of open source tooling.

What's Missing
Microsoft isn't generally in the habit of pulling features from its development tools without a revolutionary improvement that negates the need for the older feature. However, there's one particular feature missing from Visual Studio 11: macros! According to Microsoft, macro support will not be available in Visual Studio 11 -- and less than 1 percent of developers will even miss it because, according to usage data, it's rarely used. Although not so much a replacement technology, customization of Visual Studio 11 will be enabled exclusively through extensions.

Powering Productivity
As developers, we naturally expect that upgrading from one version of Visual Studio to the next means increased productivity. Visual Studio 11 is no different in this regard. However, the improvements in Visual Studio 11 indicate productivity was, in fact, an area of focus. The highlights include the Search Everywhere functionality, true multiple-monitor support, advanced file-differencing support and the new Solution Explorer window. A productivity increase is also enabled through the reengineered unit-testing support, which includes explicit work on allowing alternative testing frameworks to be integrated, continuous testing through offloading of unit test execution to a separate process, and consolidation of testing windows to a single Unit Test Explorer window.

In addition to productivity, Visual Studio includes new project types (especially in support of Windows 8 and Metro applications), integration of Expression Blend and project compatibility with Visual Studio 2010 SP1, along with the .NET Framework 4.5 and corresponding language upgrades.

And, for those developers not able to upgrade quite yet, some of the Visual Studio 11 functionality is even available in Visual Studio 2010 through the Productivity Power Tools.


More articles on Visual Studio 11:


About the Author

Mark Michaelis (http://IntelliTect.com/Mark) is the founder of IntelliTect and serves as the Chief Technical Architect and Trainer. Since 1996, he has been a Microsoft MVP for C#, Visual Studio Team System, and the Windows SDK and in 2007 he was recognized as a Microsoft Regional Director. He also serves on several Microsoft software design review teams, including C#, the Connected Systems Division, and VSTS. Mark speaks at developer conferences and has written numerous articles and books - Essential C# 5.0 is his most recent. Mark holds a Bachelor of Arts in Philosophy from the University of Illinois and a Masters in Computer Science from the Illinois Institute of Technology. When not bonding with his computer, Mark is busy with his family or training for another triathlon (having completed the Ironman in 2008). Mark lives in Spokane, Washington, with his wife Elisabeth and three children, Benjamin, Hanna and Abigail.

comments powered by Disqus

Featured

Subscribe on YouTube