Home Programming Mastering Visual Studio 2017

Mastering Visual Studio 2017

By Kunal Chowdhury
books-svg-icon Book
eBook $43.99 $29.99
Print $54.99
Subscription $15.99 $10 p/m for three months
$10 p/m for first 3 months. $15.99 p/m after that. Cancel Anytime!
What do you get with a Packt Subscription?
This book & 7000+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook + Subscription?
Download this book in EPUB and PDF formats, plus a monthly download credit
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook?
Download this book in EPUB and PDF formats
Access this title in our online reader
DRM FREE - Read whenever, wherever and however you want
Online reader with customised display settings for better reading experience
What do you get with video?
Download this video in MP4 format
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with video?
Stream this video
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with Audiobook?
Download a zip folder consisting of audio files (in MP3 Format) along with supplementary PDF
What do you get with Exam Trainer?
Flashcards, Mock exams, Exam Tips, Practice Questions
Access these resources with our interactive certification platform
Mobile compatible-Practice whenever, wherever, however you want
BUY NOW $10 p/m for first 3 months. $15.99 p/m after that. Cancel Anytime!
eBook $43.99 $29.99
Print $54.99
Subscription $15.99 $10 p/m for three months
What do you get with a Packt Subscription?
This book & 7000+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook + Subscription?
Download this book in EPUB and PDF formats, plus a monthly download credit
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook?
Download this book in EPUB and PDF formats
Access this title in our online reader
DRM FREE - Read whenever, wherever and however you want
Online reader with customised display settings for better reading experience
What do you get with video?
Download this video in MP4 format
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with video?
Stream this video
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with Audiobook?
Download a zip folder consisting of audio files (in MP3 Format) along with supplementary PDF
What do you get with Exam Trainer?
Flashcards, Mock exams, Exam Tips, Practice Questions
Access these resources with our interactive certification platform
Mobile compatible-Practice whenever, wherever, however you want
  1. Free Chapter
    What is New in Visual Studio 2017 IDE?
About this book
Visual Studio 2017 is the all-new IDE released by Microsoft for developers, targeting Microsoft and other platforms to build stunning Windows and web apps. Learning how to effectively use this technology can enhance your productivity while simplifying your most common tasks, allowing you more time to focus on your project. With this book, you will learn not only what VS2017 offers, but also what it takes to put it to work for your projects. Visual Studio 2017 is packed with improvements that increase productivity, and this book will get you started with the new features introduced in Visual Studio 2017 IDE and C# 7.0. Next, you will learn to use XAML tools to build classic WPF apps, and UWP tools to build apps targeting Windows 10. Later, you will learn about .NET Core and then explore NuGet, the package manager for the Microsoft development platform. Then, you will familiarize yourself with the debugging and live unit testing techniques that comes with the IDE. Finally, you'll adapt Microsoft's implementation of cloud computing with Azure, and the Visual Studio integration with Source Control repositories.
Publication date:
July 2017
Publisher
Packt
Pages
466
ISBN
9781787281905

 

What is New in Visual Studio 2017 IDE?

Visual Studio 2017 is the new IDE for developers released by Microsoft. It not only focuses on building applications targeting the Microsoft platform, but it can also be used to build applications using C++, Python, and so on. In short, it will be an IDE for every developer who needs to build apps on any platform.

Visual Studio 2017 will help you save time and effort for all the tasks that you want to do with your code, be it code navigation, refactoring, code fixes, debugging, IntelliSense, or unit testing of your module. Not only from the code perspective, but it will also streamline your real-time architectural dependency validation and provide stronger support for the integration of source code repositories, such as TFS (Team Foundation Server) or Git.

It comes with a brand new lightweight installation experience that modularizes the need to improve your efficiency of the fundamental tasks with a faster IDE access to a new way of viewing, editing, debugging, and testing your code.

Not only the common code editing features, but Visual Studio 2017 also comes with Xamarin, which will help you build mobile applications for Android, iOS, and Windows, more quickly and easily than ever. You can also choose the path to build mobile apps with Visual C++ or Apache Cordova, the cloud's first applications powered by Microsoft Azure.

In this chapter, we will cover the new installation experience, as well as the new features and enhancements that Microsoft has added to Visual Studio 2017. The following are the topics that we will discuss in this chapter:

  • The new installation experience:
    • Overview of the new installation experience
    • Installation using the online installer
    • Creating an offline installer of Visual Studio 2017
    • Installing Visual Studio 2017 from the command line
    • Modifying your existing Visual Studio 2017 installation
    • Uninstalling Visual Studio 2017 installation
    • Signing in to Visual Studio 2017
  • The new features and enhancements to the Visual Studio IDE:
    • Overview of the redesigned start page
    • The improved code navigation tool
    • Changes to Find All References of an instance
    • Structural guidelines
    • Editor config
    • The Roaming Extension Manager
    • Open folders in a convenient way
    • The Lightweight Solution Loading
    • The Connected Services
    • Acquiring tools and features by using the In-Product Acquisition
    • The Run to Click feature
    • Improved Attach to Process with process filtering
    • The new Exception Helper
    • Adding conditions to Exception Settings
    • Updates to the Diagnostic Tools
 

The new installation experience

In this section, we will discuss the various workloads and components of Visual Studio 2017's new installation experience. The basic installer that comes in the web-only mode allows you to select the components that you want to install before it downloads them. This saves you a lot of bandwidth. We will cover them here.

Unlike the previous versions of Visual Studio, you will not find an Offline Installer for Visual Studio 2017. You need to manually create it, which you can use to install Visual Studio 2017 without internet connectivity. This can be done by creating a layout using the web installer. Although the download size of the offline installer is big, it saves you the time and bandwidth when you want to install it on multiple devices.

In this section, we will learn how to configure and install different workloads or components using the online and offline installers. We will then continue to learn the ways to modify or uninstall the Visual Studio installation, as well as signing in to the IDE for a synced workspace setting across devices.

Before going into depth, let's see the system requirements to install Visual Studio 2017:

  • Visual Studio 2017 will install and run on the following operating systems:
    • Windows 10 version 1507 or higher to build apps for Universal Windows Platform (UWP)
    • Windows Server 2016
    • Windows 8.1 (with Update 2919355)
    • Windows Server 2012 R2 (with Update 2919355)
    • Windows 7 SP1 (with the latest Windows Updates)
  • Here's the hardware requirements:
    • 1.8 GHz or faster processor. It's recommended to have dual core or higher.
    • At least 2 GB of RAM, minimum 2.5 GB if running in a Virtual Machine. It's recommended to have 4 GB of RAM.
    • It's recommended to have 1 GB to 40 GB HDD space, based on the features you are going to install.
    • Visual Studio will work best at a resolution of WXGA (1366 by 768) or higher.

Overview of the new installation experience

The new version of the installer that is used to install Visual Studio 2017 allows you to control the individual workload/module that you need. Unlike the previous versions of the installer, it does not take more installation space; rather, it allows you to do a basic installation, having a few hundred MBs only for the core editor to install. On a need basis, you can select the workload or the individual module.

The Workloads screen will allow you to select the module that you want to install. If you want to build applications targeting Windows 10 only, you should go with Universal Windows Platform development. Consider the following screenshot:

If you want to build applications for Python or Node.js, the respective workloads are there to help you install the required components. Consider the following screenshot:

We will discuss more about the installation steps in the next point, where we will see how to install Visual Studio 2017 using the online installer.

Installation using the online installer

You can go to https://www.visualstudio.com/downloads/ and select the Visual Studio 2017 edition that best suits your need and then download it. There are three different editions available--Visual Studio Community 2017, Visual Studio Professional 2017, and Visual Studio Enterprise 2017.

The Visual Studio Community edition is a free, fully-featured IDE for students, open source developers, and individual developers. In all these cases, you can create your own free or paid apps using the Visual Studio 2017 Community edition. Organizations will also be able to use the Community edition, but only under the following conditions:

  • In an enterprise organization, an unlimited number of users can use the Community edition if they are using it in a classroom learning environment, academic research, or an open source project. An organization is defined as an enterprise organization if they have more than 250 computers or a 1 million dollar annual revenue.
  • In a non-enterprise organization, the Community edition is restricted to up to five users.

To know more about the Visual Studio Community 2017 license terms, check out this page:

https://www.visualstudio.com/license-terms/mlt553321/

If you are a professional in a small team, you need to select Visual Studio Professional 2017, and for end-to-end solutions by a team of any size, select Visual Studio Enterprise 2017.

Once you have downloaded the online/web installer, double-click on it to start the installation process. This will first show a screen where you can read the License Terms and Microsoft Privacy Statement, which you need to agree to before continuing with the installation process. Once you click on the Continue button, the installer will take a few minutes to prepare itself. This is shown in the following screenshot:

The main screen of the installer has three different tab contents--Workloads, Individual components, and Language packs.

The Workloads tab allows you to select the group of components that comes under a single module. In other words, each workload contains the features you need for the programming language or platform you prefer.

For example, if you like to build Windows Presentation Foundation (WPF) applications, you need to select .NET desktop development, and to build ASP.NET web applications, you need to select the ASP.NET and web development module under the workloads.

To install and build applications for both WPF and Windows 10, select .NET desktop development and Universal Windows Platform development, as shown in the following screenshot. For each individual workload, the selected components will be listed in the panel on the right-hand side of the screen:

The Individual components tab lists all the component parts of individual workloads, category wise, for you. The components part of the selected workloads will be auto-checked by default.

Only use this section if you are an advanced user. Some components may have dependencies with one or more workloads. Deselecting one of them can cause the other workloads to unload from the installation process. So, be cautious while selecting/deselecting any one of them.

The third tab is the Language packs tab, which allows you to choose the language that you want to use with Visual Studio 2017. By default, it's the system's default language selected on the screen; however, you can opt for Czech, French, German, or any other languages from the available list shown in the following screenshot:

By default, a location is prepopulated for the installer to install Visual Studio 2017, but you can change it to a different folder. Once you are done, click on the Install button.

This will start the actual installation process. If you are using the web installer, it will download an individual module from the Microsoft server and install them gradually. This may take some time, based on your selected workloads/components and internet bandwidth. Consider the following screenshot:

This will be fast and take less time than the previous IDE installers. Once it completes the installation, it may ask you to restart your system to take into effect the changes that it made to start the Visual Studio instance. If you see such a message on the screen, as shown in the following screenshot, make sure to restart your computer by clicking on the Restart button:

From the same page, you will be allowed to modify the existing installation, launch the Visual Studio 2017 IDE, or uninstall the complete installation.

Creating an offline installer of Visual Studio 2017

Sometimes, we may need to have an offline copy of the installer so that we can install it to multiple devices without an active or fast internet connection. This will save your bandwidth from downloading the same copy multiple times over the network. The offline installer is big. So, before going further to create the offline copy, make sure that you have an active internet connection available with no limitation of download bandwidth.

  1. First, download the Visual Studio setup executable file (web installer) to a drive on your local machine.
  2. Now, run the downloaded setup executable with the following arguments (switches) from a command prompt:
    • Add --layout <path>, where <path> is the location where you want the layout to be downloaded. By default, all languages will be downloaded along with all the packages.
    • In case you want to restrict the download to a single language only, you can do so by providing the --lang <language> argument, where <language> is one of the ISO country codes given in the following list. If not specified, support for all localized languages will be downloaded.

ISO CODE

LANGUAGE

cs-CZ

Czech

de-DE

German

en-US

English

es-ES

Spanish

fr-FR

French

it-IT

Italian

ja-JP

Japanese

ko-KR

Korean

pl-PL

Polish

pt-BR

Portuguese - Brazil

ru-RU

Russian

tr-TR

Turkish

zh-CN

Chinese - Simplified

zh-TW

Chinese - Traditional

For example, to download the Visual Studio 2017 Enterprise edition under the local path C:\VS2017\, you need to provide the following command:

vs_enterprise.exe --layout "C:\VS2017\"

To download the English localized edition to local path C:\VS2017\, provide the following command:
vs_enterprise.exe --layout "C:\VS2017\" --lang "en-US"

To download only the .NET desktop development workload, run:
vs_enterprise.exe --layout "C:\VS2017\" --add Microsoft.VisualStudio.Workload.ManagedDesktop

To download the .NET desktop development and Azure development workloads, provide the following command:

vs_enterprise.exe --layout "C:\VS2017\" --add Microsoft.VisualStudio.Workload.ManagedDesktop Microsoft.VisualStudio.Workload.Azure

As shown in the following screenshot, it will start downloading all the packages part of Visual Studio 2017. As the offline installer is big, it will take plenty of time, depending on the speed of your internet network:

Once the download completes, go to the folder where you downloaded the packages (in our case, it's C:\VS2017\) and run the installer file, that is, vs_enterprise.exe, for example. Then, follow the same steps as mentioned earlier to select the required Workloads and/or Individual components to start the installation process.

Installing Visual Studio 2017 from the command line

You can use command-line parameters/switches to install Visual Studio 2017. Be sure to use the actual installer, for example, vs_enterprise.exe for the Visual Studio 2017 Enterprise edition, and not the bootstrapper file, which is named vs_setup.exe. The bootstrapper file loads the MSI for actual installation. You can also run C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installershell.exe to install the Visual Studio components from the command line.

Here is a list of the command-line parameters/switches:

Parameters/Switch

Description

[--catalog] <uri> [<uri> ...]

Required -- One or more file paths or URIs to catalogs.

--installDir <dir>
--installationDirectory <dir>

Required -- The target installation directory.

-l <path>, --log <path>

Specify the log file; otherwise, one is automatically generated.

-v, --verbose

Display verbose messages.

-?, -h, --help

Display parameter usage.

--instanceId <id>

Optional -- The instance ID to install or repair.

--productId <id>

Optional -- The product ID to install. Otherwise, the first product found is installed.

--all

Optional -- Whether to install all workloads and components for a product.

--add <workload or component ID> ...

Optional -- One or more workload or component IDs to add.

--remove <workload or component ID> ...

Optional -- One or more workload or component IDs to remove.

--optional, --includeOptional

Optional -- Whether to install all optional workloads and components for selected workload.

--lang, --language <language-locale> ...

Optional -- Install/uninstall resource packages with the specified languages.

--sharedInstallDir <dir>

Optional -- The target installation directory for shared payloads.

--compatInstallDir <dir>

Optional -- The target installation directory for legacy compatibility payloads.

--layoutDir <dir>
--layoutDirectory <dir>

Optional -- The layout directory in which to find packages.

--locale <language-locale>

Optional -- Change the display language of the user interface for the installer. Setting will be persisted.

--quiet

Optional -- Do not display any user interface while performing the installation.

--passive

Optional -- Display the user interface, but do not request any interaction from the user.

Here is a list of workload IDs that you need to provide while installing Visual Studio 2017 from the command line:

  • Microsoft.VisualStudio.Workload.CoreEditor: This is the core part of Visual Studio 2017 containing the core shell experience, syntax-aware code editing, source code control, and work item management.
  • Microsoft.VisualStudio.Workload.Azure: This contains the Azure SDK tools and projects to develop cloud apps and create resources.
  • Microsoft.VisualStudio.Workload.Data: Using this workload, you can connect, develop, and test data solutions using SQL Server, Azure Data Lake, Hadoop, or Azure Machine Learning.
  • Microsoft.VisualStudio.Workload.ManagedDesktop: This workload will help you build WPF, Windows Forms, and console applications using the .NET Framework.
  • Microsoft.VisualStudio.Workload.ManagedGame: If you are a game developer, you can create 2D and 3D games with Unity, a powerful cross-platform development environment.
  • Microsoft.VisualStudio.Workload.NativeCrossPlat: Want to create and debug applications running in a Linux environment? This workload will allow you to build native cross platform apps.
  • Microsoft.VisualStudio.Workload.NativeDesktop: Classic Windows-based applications using the power of the Visual C++ toolset, ATL, and optional features such as MFC and C++/CLI can be built using this workload.
  • Microsoft.VisualStudio.Workload.NativeGame: If you are a game developer, you can use the full power of C++ to build professional games powered by DirectX, Unreal, or Cocos2d.
  • Microsoft.VisualStudio.Workload.NativeMobile: Using this, you can build cross-platform applications for iOS, Android, or Windows using the C++ APIs.
  • Microsoft.VisualStudio.Workload.NetCoreTools: .NET Core is a new addition to Visual Studio. You can build cross-platform applications using .NET Core, ASP.NET Core, HTML, JavaScript, and CSS.
  • Microsoft.VisualStudio.Workload.NetCrossPlat: To build cross-platform applications for iOS, Android, or Windows using Xamarin, you will need to have this workload installed on your development environment.
  • Microsoft.VisualStudio.Workload.NetWeb: You can build web applications using ASP.NET, ASP.NET Core, HTML, JavaScript, and CSS using the NetWeb workload.
  • Microsoft.VisualStudio.Workload.Node: To build scalable network applications using Node.js and asynchronous event-driven JavaScript runtime, you will need this workload.
  • Microsoft.VisualStudio.Workload.Office: To create Office and SharePoint add-ins, SharePoint solutions, and VSTO add-ins using C#, VB, and JavaScript, you will need this Office workload.
  • Microsoft.VisualStudio.Workload.Universal: To create applications targeting the Universal Windows Platform with C#, VB, JavaScript, or, optionally, C++, you need to install this workload.
  • Microsoft.VisualStudio.Workload.VisualStudioExtension: If you want to create add-ons and extensions for Visual Studio, you will need to install this workload. This also includes new commands, code analyzers, and tool windows.
  • Microsoft.VisualStudio.Workload.WebCrossPlat: To build Android, iOS, and UWP apps using Tools for Apache Cordova, you will need this.

Each of the preceding workloads has its own set of components, which you can refer to from the official Microsoft page (https://aka.ms/vs2017componentids).

Modifying your existing Visual Studio 2017 installation

After the installation ends, if you later decide to modify the existing installation to add or remove any components or uninstall the installation, you can do so from the control panel - Add/Remove Programs. Alternatively, you can launch the Microsoft Visual Studio Installer and click on Modify, as shown in the following screenshot:

To add new modules, check the new workloads, or to remove modules, uncheck the existing workloads, and proceed toward modifying the existing installation.

Uninstalling Visual Studio 2017 installation

If you have set your mind to uninstall all the packages that Visual Studio 2017 installed, the new installer that comes with it can help you uninstall the entire packages completely, without keeping any trace of the components.

You can also launch the Microsoft Visual Studio Installer, click the icon, then Uninstall, as shown in the following screenshot, and then click on OK when asked:

Signing in to Visual Studio 2017

Once you are done with the installation, open your Visual Studio 2017 IDE. When you open it for the first time, it will ask you to sign in. Be sure to sign in with your MSA (Microsoft Account) ID or a work/school account that best represents you. If you don't have an existing account, you can create a personal account for free.

Although it is optional to sign in, it is good to keep all your Visual Studio settings and personalization settings synced in the cloud. Doing so will help you use the same settings from any other devices. If you are working on multiple devices, syncing your settings will help you in many ways (includes Theme).

Here is the screenshot of the sign-in screen of Visual Studio, where you need to provide your account credentials:

Not only will signing in help you extend your trial license, but it will also help if you installed the Visual Studio trial version. By default, it will have a 30 day trial period. Once you sign in to Visual Studio 2017, you will get an additional 90 days to try it.

If you have an account that's associated with the MSDN or VSO (Visual Studio Online) subscription, signing in to Visual Studio will automatically unlock your installation. It will also connect to services such as Microsoft Azure and Visual Studio Team Services in the IDE without prompting again for credentials for the same account.

If you missed logging in to Visual Studio at the first start of the IDE, you can do so later from the Visual Studio by using this path: Help | Register Product | Sign in, or by clicking on the Sign in link available at the top-right corner of the screen, as shown in the following screenshot:

Unless you sign out, you will be automatically signed in to Visual Studio whenever you start it. This will synchronize all your changes to the settings in the cloud.

 

The new features and enhancements to the Visual Studio IDE

Every new product comes with new features and enhancements to the existing one, to give you more control over what you need. It's the same with Visual Studio 2017 having product version 15. Microsoft has changed many things in this new redesigned IDE and added many things to improve your productivity.

Ranging from the installation point of view to the IDE level, many things have been incorporated. We have already discussed the new installation experience. Now we will discuss the new features/enhancements at this point. Starting from the redesigned start page, we will cover the improved navigation tool, the changes that have been made in the Find All References window, structural guidelines, editor config, the roaming extension manager, lightweight solution loading, connected services, run to click feature, and many more.

Overview to the redesigned start page

In Visual Studio 2017, Microsoft has brought you a faster installation experience, better performance, and new/enhanced productivity features. One of these productivity features is a Start Page redesigned by the Microsoft team. This will help you start working on your code faster, with easy access to whatever you need.

Here is a quick peek of the redesigned Start Page:

The first item here is the Get Started section having a few links to get you started, but this is not always helpful and covers part of your Start Page. To get out of it, hover on the Get Started section to see a close (x) button. Clicking on it will collapse the said section and, thus, will give more space to the Recent / Most Recently Used (MRU) list.

The MRU list in the Start Page will allow you to quickly find what you're looking for. Each MRU item will display an icon denoting it as a project, a solution, a folder, a file path for local resources, or a remote URL for remote items not yet on the local system.

To help you stay more productive in your daily work, the MRU on the Start Page has some additional features:

  • Along with Projects and Solutions, it also lists recently opened folders.
  • It groups the list by date and can accommodate a longer history of files, folders, projects, and solutions.
  • You can pin an MRU item to the top of the list so that you can easily access your most important items.
  • If you are using multiple devices and are already signed into your Visual Studio installation on all the devices, the MRU list will also show you a roaming item.
  • If you cloned a remote repository, Visual Studio will roam the item in any of your devices that have the same associated account, and clicking on any of them will automatically clone it down for you to continue your work. Consider the following screenshot:

The New Project section in the Visual Studio 2017 start screen will allow you to get easy access to the project templates. If you have recently created any projects out of any templates, it will list all those recently used project templates.

You can also search for any project templates and use the one from the list. This is to help you speed up the process of creating new projects using the new IDE by bypassing the steps to find and select the desired template in the New Project dialog. If you sign into Visual Studio, this list will also roam with you across your devices:

To help you simplify the open project/solution experience, Microsoft placed a panel on the Start Page. From there, you can directly clone your remote repositories, either from on-premise TFS, cloud-hosted TFS, or shared on GitHub. You can also open projects/solution or open the folder from this screen.

The VSTS (Visual Studio Team Services) extension is already in built to Visual Studio 2017; GitHub is a third-party extension, but comes along with it as an optional download. If you are not able to find GitHub on the Start Page, run the installer or install it using the In-Product acquisition:

The Developer News section is the place where you can stay updated with the latest news. Although some developers like to read it every day, not everyone does. Hence, Microsoft now allows you to collapse this section and stay focused on your code-related stuff on the start page. A small badge will be there on the arrow circle to notify you of new posts in the news feed. Consider the following screenshot:

Did you know? Hovering your mouse over the Get Started section provides you with an x button to close the same and gain more space for the Recent/MRU list.

The improved code navigation tool

With Visual Studio 2017, Microsoft has improved the code navigation feature to let you quickly find and go to line, files, types, methods, and other elements in your code. It gives you a one-stop way to go to any kind of item that you are looking for, even in a large code base, helping you find the item easily. You can access it from the Visual Studio Edit | Go To menu or by using the keyboard shortcuts listed as follows:

The Go To toolbox that pops up has a few toolbox buttons to easily switch between the navigational types, such as line, files, types, symbols, members, and so on, and a search box:

It also offers you easy access to the toolbox buttons with shortcuts. The shortcuts are actually a character that you start the search with. For example, starting a search with t will directly navigate you to Types search. To find out the search key shortcut, enter ? in the search box. It will show help, as shown in the following screenshot:

If you want to navigate to a specific line, enter : <LineNo> (for example, : 25) to see a quick view of the line, and confirming it will directly navigate you to that specific line number. You can also access it using the keyboard shortcut, Ctrl + G.

The Go to line was already there in earlier versions of Visual Studio, but the quick preview of the same before navigating has been added with Visual Studio 2017.

Take a look at the following screenshot to grasp an idea of previewing the line before confirming it:

If you start the search with f, followed by the key term, it will search the term in the file name and show you a quick preview of the selected file along with the file path. For example, to list all the C# files having Helper at the end of their names, enter f helper.cs in the search box, as shown in the following screenshot; interestingly, you will see the result along with the file path, which is blurred in this screenshot. Use the up/down arrow keys to select the result for a quick view of the selected file:

If you want to search for types such as class, interface, enum, and so on, you can start the search with the character t, as shown here:

To start a symbol search, begin the search term with the # character and you will find the result having entered term like this:

Similarly, to search for a member, begin the search with m and your search key; you will get the result matching the key for any members in the solution, as shown in the following screenshot:

You can also search by clicking on the respective buttons, which will automatically add the contextual search character at the beginning of the search key. However, if you remember the character, it will be very quick for you to access the required resource without using your mouse cursor.

The last two toolbox buttons will help you switch between Current Document and external items. You can quickly switch between them using the keyboard shortcut Ctrl + Alt + C.

Changes to Find All References of an instance

The Find All References command in Visual Studio is not a new thing. It's used to find out all the references of a member or symbol. In earlier versions of Visual Studio, the UI of the result dialog was simple, having only the results in a grouped list. You can find the previous result dialog here:

However, there was always a demand to improve it, as most developers use it regularly to check for references of a member, type, or symbols. Microsoft worked on it in Visual Studio 2017 and have provided a rich UI for developers to improve their daily productivity.

It now has an advanced grouping, filtering, sorting, and searching within the reference result. It now also has a colorization of the term in the result, giving you a clear understanding of the references and directly moving you into the line of code that you are looking for. Here, you can see the new result dialog:

The resultant dialog lists the results in a grid, having column headers to give you clear visibility of the records, which includes the code, file name, line number, and so on for your easy reference. You can use the column headers to sort the result based on your need.

When you hover your mouse over a resultant item in the grid, a tooltip is displayed with the context of the reference in source code. This gives you a quick peek of what you are looking for.

The toolbar of the dialog has many new toolbox items. Let's understand each one of them, as follows:

  1. This list has a few entries with which you can filter the records to solution level, project level, and so on. The list consists of the following entries:
    • Entire Solution
    • Open Documents
    • Current Project
    • Current Document
    • Changed Documents
  1. This is the Copy button that copies the content of the selected record.
  2. These are the two buttons for navigation purposes. This will navigate you to the previous and next location in the list.
  3. This button is used to clear all the filters.
  4. This combination list allows you to change the Group by definition. You can choose any one of the following:
    • Project then Definition
    • Definition only
    • Definition then Project
    • Definition then Path
    • Definition, Project then Path
  1. This is another new toggle button to help you keep the current result on the screen when you trigger another Find All Reference command. When the Keep Results button is turned ON, the next invocation of Find All References will populate the reference results in a new window.
  2. The search box will allow you to search within the result set to give you the perfect result that you are looking for.

Structural guide lines

Visual Studio 2017 also focuses on a new feature called Structural guide lines. The Structural Guide Lines are drawn in the editor so that you can easily visualize the structure of the code that you are currently working on. When you mouse hover on the guideline, a tooltip containing the context of the current code block relative to its ancestor blocks is displayed. Here, in the following screenshot, you can see how the lines are drawn and how the tooltip is displayed with its ancestor blocks when you hover over the guide lines of the using block:

This feature is enabled by default. If you want to disable it, you can navigate to the Visual Studio options dialog at the path: Tools | Options | Text Editor | General, and uncheck the checkbox labelled Show structure guide lines.

To enable it again, follow the same path and check the same box, as shown in the preceding screenshot.

Editor config

Editor config helps developers define and maintain consistent coding styles between different editors and/or IDEs. Microsoft has added support of Editor config in Visual Studio 2017.

The default text editor settings in Visual Studio applies to all projects of a given type. For example, if you change a C# or VB.NET text editor's settings, those settings will apply to all C# projects and VB.NET projects respectively. However, in general, the coding conventions that you use in your personal projects may differ from those used in your team's projects.

Here comes the Editor Config that enables you to do this on a per project basis and/or per folder level. In this case, the settings are contained in a .editorconfig file added to your code base. As the settings are contained in a file in the code base, they travel along with the code base:

The Editor Config doesn't support a full set of C# formatting rules and, hence, it's not a replacement for format settings in Visual Studio. Currently, it supports the following settings only in Visual Studio 2017:

  • indent_style
  • indent_size
  • tab_width
  • end_of_line
  • charset
  • root
  • trim_trailing_whitespace
  • insert_final_newline
  • Code style conventions

You can create an editor configuration file at the project level or at any folder level. When you add it to the project's root level, its settings are applied across all the files in the project. If you add it to any specific folder level inside the project, the root settings will be overridden and will apply to all applicable files at that level and below.

Did you know? Adding an .editorconfig file to your project or code base will not convert the existing styles to new ones. It will apply the settings to only newly added lines in that code base. To make an entire document adhere to the code formatting rules defined in your editor configuration, you can use the Format Document (Ctrl + K, D) command.

To create an Editor Config (.editorconfig) file, right-click on a project or folder where you want to apply the settings, and then, from the context menu, click on Add | New Item..., as shown in the following screenshot:

Now, from the Add New Item dialog box, select the Text File template and give it a name, for example, .editorconfig, as shown in the following screenshot, to add the file. Note that the file name only consists of the extension of the file:

The .NET code style settings allow you to enforce the style that you want to use in your code base. Depending on the severity set in the Editor Config, it can show you a suggestion, a compiler warning, or compiler error. This can be written in the following fashion:

options_name = false|true : none|suggestion|warning|error 

The option must specify true (preferable) or false; a colon, :, and a severity of none, suggestion, warning, or error. The default is none.

If you set the severity as none, it will not show anything to the user when this style is not being followed. If you set it as a suggestion, it will show a suggestion (underlying dots on the first two characters) when the style is not being followed. In case of warning or error, it will either show compiler warning or compiler error if the code does not match the style being applied to it.

The Roaming Extension Manager feature

The Roaming Extension Manager is a new feature in Visual Studio 2017 and can be seen under the Extensions and Updates dialog box. This allows you to keep a track of all your favorite extensions. It allows you to sync the installed extensions by creating a synchronized list in the cloud if you have already signed in on all your Visual Studio IDEs across all your development environments.

Navigate to the Tools | Extensions and Updates menu in your Visual Studio instance and expand the entry that says Roaming Extension Manager. Under this, you will find all the extensions roamed with your account. This is shown in the following screenshot:

Here, you will find three kinds of icons:

  • Roamed icon (): If the extension is a part of your roaming list, but not installed on this machine, you will get this roamed icon overlayed on it. Click on the Download button to install the extension.
  • Roamed and installed icon (): This icon will be set as an overlay, when an extension is part of your roaming list and is installed on this system too.
  • Installed icon (): When an extension is not a part of your roaming list, but present on this machine, it will get this installed icon overlay.

If you want to add any extensions to the roaming list to roam along with your account, select the specific extension and click on the Start Roaming button. When the extension is roaming, it will auto-install on the other system, where you sign in to Visual Studio with the same personalized account:

If you do not want to roam an extension for any reason, you can remove it from the roaming list by clicking on the Stop Roaming button of that extension, which is shown in the following screenshot:

If you have any favorite extensions that you use regularly on all your devices, you will love to sync them with your account. This way, you don't have to manually search and install them on the new system where you will write your code.

Did you know? If you download an extension when you are already signed in to Visual Studio 2017, it will be added to your roaming list, giving you easy access to it from any of your development environments.

Open folders in a convenient way

In Visual Studio 2017, Microsoft has provided a convenient way to work with the code base. You can now directly open a folder instead of opening the solution/project explicitly. When you open a folder, you can easily navigate to all files by structural folders using the Solution Explorer. Not only this, but you can also build your projects from the Solution Explorer; right-click on context menu.

In order to open a folder, you can click on File | Open | Folder... from the Visual Studio menu or the Open Folder link present on the Start Page. Alternatively, you can press the keyboard shortcut: Ctrl + Shift + Alt + O:

The folder view also supports the following:

  • Searching across the code in your folder with the Go To (Ctrl + ,) command.
  • Scoping the Solution Explorer folder view to subfolders. To scope your current context to a specific project/folder, right click on it and then click on Scope To This from the context menu.
  • Opening folders in Explorer or the Command Prompt from the Solution Explorer itself.
  • Easily toggle between solutions with the Solution selection dropdown.
  • Configuring the debug and launch settings with launch.json. Right-click on a debuggable file and select Debug and Launch Settings.
  • Configuring tasks and customizing the build with tasks.json. Right-click on any file and select Configure Task Settings.
  • Launch.vs.json and tasks.vs.json have IntelliSense in the JSON editor.
  • Integration with supported source control repositories. This will provide you the current status of the file. As shown in the following screenshot, a + or a tick mark provides you the status of the local file in comparison with the version available in source control repository:

You can also open a folder from the Windows Explorer window by right-clicking on any folder and then clicking the Open in Visual Studio context menu item, as shown in the following screenshot:

Lightweight solution loading

Lightweight solution loading is yet another feature of Visual Studio 2017 that enables you to load large solutions faster, reducing the load time and memory usages, as it loads only the files that are needed (per need basis). It is best suited to large solutions that contain C# or a mix of C# and C++ projects. If Visual Studio decides that you are working with large solutions, it will prompt you to enable this feature.

This feature is not enabled by default. To enable it, open Visual Studio Options from Tools | Options and navigate to Projects and Solutions | General. On the right-side panel, you will find a setting labelled Lightweight solution load for all solutions. Check it to enable the feature. Uncheck it if you decide to go back to the previous settings.

Alternatively, you can search for Lightweight Solution load in the Quick Launch search box to directly navigate to it:

Once you enable the feature, it will apply the lightweight solution loading to all solutions that you open using Visual Studio 2017. If you don't want this but would like to open a solution only, you can enable it for that specific solution by right-clicking on the solution file in the Solution Explorer. There, you will find a context menu entry that says Enable Lightweight Solution Load. This is shown in the following screenshot:

Connected Services

Microsoft added a new Getting Started experience for freshly created projects in Visual Studio 2017. It replaced existing Getting Started pages with an Overview tab in the new App Configuration Designer and focused the page on the actions that will get you started quickly to build your app, add an application insight/other connected services, publish your app to Azure, and set up continuous delivery:

In Visual Studio 2015, we saw a section called Service Capabilities. In Visual Studio 2017, they have changed it to Connected Service to modernize the Add Connected Service and Add Service Reference features.

This will allow you to connect your app to services. A new node called Connected Services is available in the Solution Explorer for web and mobile applications. Double-clicking on this node will open a new full-page tab in Visual Studio where you can configure popular Microsoft services available for you to connect to.

Using Monitoring with Application Insights, you can gain insights through telemetry, analytics, and smart detection in the following ways:

  • Detect and diagnose exceptions and application performance issues
  • Monitor the website insights hosted on Azure, containers, on-premises, and on other cloud providers
  • Integrate with your DevOps pipeline using Visual Studio, VSTS, GitHub, and Webhooks

Here is the screenshot of the Connected Services screen present inside Visual Studio 2017:

The Cloud Storage with Azure Storage feature will allow you to store and access data with Azure Storage services, such as Blobs, Queues, and Tables. If you have an Azure subscription, you can connect to it and start using it on your web or mobile apps. You can also connect to the Azure App Service to add authentication and deliver push notifications for mobile apps.

The other popular service, Office 365 APIs, will allow you to integrate your applications with Office 365 Services. A wizard is there to help you easily configure your project to connect with services such as mail, calendar, contacts, files, and more. You can also create an application in the Azure Active Directory associated with your Office 365 domain. To get started, you should have a valid Office 365 subscription available.

There is a Find more services link at the bottom of the page, which will open the Visual Studio Marketplace under the Extensions and Updates option, where you will be able to connect to more services.

Acquiring tools and features by using In-Product Acquisition

Visual Studio 2017 makes it easier to acquire any missing components using In-Product Acquisition. Using this, you don't have to leave the IDE to start the installer. Using the Quick Launch search bar, you can kick off the installer to start an in-product acquisition of any workload or individual component. Consider the following screenshot:

The preceding image shows us how to use Visual Studio to acquire a Universal Windows Platform development workflow and other related components. This will directly launch the installer and proceed towards the installation of said workflow.

If you cannot find the templates that you are looking for, the Visual Studio 2017 installer can also be opened from the New Project dialog box, as shown in the following screenshot:

The Run to Click feature

Debugging now becomes easier with Visual Studio 2017. You can simply click on an icon next to a line of code to run to that line while debugging. When you have stopped at a breakpoint, just click on the green Run to Click icon that subtly appears next to the line of code that your mouse is hovered over. This will reduce the burden of adding temporary breakpoints and several steps that need to be performed to break the debugger to a specific line on the fly:

This feature is enabled by default. To disable it, click on the menu item Tools | Options and then navigate to Debugging | General. Alternatively, you can directly navigate there by clicking on the menu item Debug | Options. Scroll to the end of the right-side panel and find an option labelled Show run to click button in editor while debugging. Uncheck it to disable the feature.

If you want to re-enable it later, follow the same steps and check the aforementioned option. Consider the following screenshot:

Improved Attach to Process with process filtering

In the earlier versions of Visual Studio, it was quite difficult to search for a particular process in the Available Processes list of the Attach to Process dialog box. To overcome this, Microsoft has added a search box in the top-right corner of the list. It will help you filter the list and find out the exact process that you are looking for:

To help you further in this long process list, history entry has been added to the search box. When you are in this window at a later point of time, you can click on the arrowhead to select the last search item from the list.

A new entry labelled Reattach to Process... has been added to the Debug menu of Visual Studio 2017 to help you reattach to the process that you used last. Alternatively, you can press the keyboard shortcut, which is Shift + Alt + P, to directly attach the debugger to the last processes from the previous debugging session. This is shown in the following screenshot:

The debugger will first try to reattach to the process by matching the previous process ID, and then by matching to the previous process name. If no matches are found, or if there are multiple processes with the same name, the Attach to Process dialog will open to allow you to select the desired process from the list.

The new exception helper

Handling an exception is the most crucial part for a developer and it becomes frustrating when you are unable to define the cause of the same. Previous versions of Visual Studio do not provide more details about the exception other than a generic contextual UI to the developer in debug mode.

Microsoft worked on a redesigned UI for the exception helper to give you more details of the exception in a compact non-modal dialog with quick access to the inner exception. When there is a NullReferenceException, the new UI shows you what was null. Take a look at the following screenshot that shows antivirusList was null, which caused the issue:

Add conditions to Exception Settings

Visual Studio 2017 allows you to add conditions when you configure the debugger to break on thrown exceptions from a specific module. Thus, the breakpoint will hit only when the specified condition is met. You can use the asterisk/wildcards to broaden the conditions, as shown in the following screenshot:

Updates to Diagnostic Tools

When you start your debugging session inside Visual Studio, the Diagnostic Tools window becomes visible, having many details on the screen. With Visual Studio 2017, you can now view the number of Application Insights and UI Analysis events (UWP apps only) that occurred in your application, along with the number of Exceptions and IntelliTrace events. You can also take a memory snapshot of your heap and enable or disable the CPU profiling:

If you don't want to load Diagnostic Tools when the debugger session starts, you can disable it by unchecking the Enable Diagnostic Tools while debugging checkbox under the debugging options. Consider the following screenshot:

 

Summary

By the end of this chapter, you will have learned many things that have been newly added/modified in Visual Studio 2017. You learned about the workloads and the individual components part of the new installation experience. You also learned how to create an offline layout of the installer and the step-by-step instructions to install Visual Studio 2017 on your system.

Apart from those, we also covered the new and improved changes in Visual Studio 2017 IDE that will improve the productivity of developers. Whether you want to create a new project, open an existing one, or work with code, find the references of any symbol, or debug, you will find it useful and easy to use everywhere. Also, the convenient way to open a folder, load the solution in a lightweight manner, or acquire additional components using the In-Product Acquisition is second to none.

In the next chapter, we will discuss the new features introduced in C# 7.0 that have been introduced with Visual Studio 2017 for developers to build rapid and robust applications without spending too much time on code.

About the Author
  • Kunal Chowdhury

    Kunal Chowdhury is an author, a passionate blogger, and a software engineer by profession. He was a Microsoft MVP from 2010 to 2018. Over the years, he has acquired profound knowledge of various Microsoft products and services, and has helped developers and consumers throughout the world. As a tech buff, Kunal has in-depth knowledge of C#, XAML, .NET, WPF, Visual Studio, Windows 10, and Azure. He has written many articles on his technical blog for developers and consumers. You can contact him on Twitter (kunal2383) and become one of his fans. He has also authored the books Mastering Visual Studio 2017 and Windows Presentation Foundation Development Cookbook, both available from Packt Publishing.

    Browse publications by this author
Latest Reviews (4 reviews total)
The books were well written, clear, and comprehensive. The videos were informative, well paced, and practical.
Essenziale ed approfondito. Non molto dettagliato sulla componente C++
It's been a month since I've purchased my book and still have not received it. No feed back and no support what so ever. This company is a joke. But not the funny one at all.
Mastering Visual Studio 2017
Unlock this book and the full library FREE for 7 days
Start now