Discover millions of ebooks, audiobooks, and so much more with a free trial

Only $11.99/month after trial. Cancel anytime.

Visual Studio 2015 Cookbook - Second Edition
Visual Studio 2015 Cookbook - Second Edition
Visual Studio 2015 Cookbook - Second Edition
Ebook816 pages6 hours

Visual Studio 2015 Cookbook - Second Edition

Rating: 0 out of 5 stars

()

Read preview

About this ebook

About This Book
  • Get to grips with all the new Visual Studio 2015 features regardless of your preferred programming language
  • Apply Visual Studio to all areas of development: writing, debugging, and application lifecycle maintenance
  • Straightforward and hands-on advice for building both Windows and Android apps
Who This Book Is For

If you already know your way around the previous versions of Visual Studio, if you are familiar with Microsoft development, and if you're looking to quickly get up to speed with the latest improvements in the 2015 edition of Microsoft's number one development tool, this book is for you.

If you are an experienced developer who has used Eclipse or XCode, you should also be able to find this book useful to explore the differences between your tools and the latest ones that Microsoft has to offer.

LanguageEnglish
Release dateAug 19, 2016
ISBN9781785885938
Visual Studio 2015 Cookbook - Second Edition
Author

Jeff Martin

Jeff Martin first stumbled upon his passion for languages on his first trip to Brazil at the age of 17. Since then, he has become fluent in several languages, and now works as a master certified Spanish court interpreter. Throughout his journey, he has met many people who ask him the same question. "How can I become fluent in a foreign language?" Through over 11 years of research, analysis, interviews, language lessons, and ultimately watching his children learn to speak, he developed the answer to that question in the form of a book.

Read more from Jeff Martin

Related to Visual Studio 2015 Cookbook - Second Edition

Related ebooks

Software Development & Engineering For You

View More

Related articles

Reviews for Visual Studio 2015 Cookbook - Second Edition

Rating: 0 out of 5 stars
0 ratings

0 ratings0 reviews

What did you think?

Tap to rate

Review must be at least 10 words

    Book preview

    Visual Studio 2015 Cookbook - Second Edition - Jeff Martin

    Table of Contents

    Visual Studio 2015 Cookbook Second Edition

    Credits

    About the Author

    About the Reviewer

    www.PacktPub.com

    eBooks, discount offers, and more

    Why subscribe?

    Preface

    Choosing the right version of Visual Studio 2015

    What this book covers

    What you need for this book

    Who this book is for

    Sections

    Getting ready

    How to do it…

    How it works…

    There's more…

    See also

    Conventions

    Reader feedback

    Customer support

    Downloading the color images of this book

    Errata

    Piracy

    Questions

    1. Exploring Visual Studio 2015

    Introduction

    Synchronizing settings

    Getting ready

    How to do it…

    How it works…

    There's more…

    Touring the VS2015 IDE

    Getting ready

    How to do it…

    Send Feedback

    Notifications

    User account

    Scroll bar thumbnail

    Peek Definition

    CodeLens (Visual Studio Professional and Enterprise only)

    Code Maps (Visual Studio Enterprise only)

    See also

    Managing the editor windows

    Getting ready

    How to do it…

    How it works...

    There's more...

    Single-click preview in Solution Explorer

    Customizing tab and window behavior

    Finding Visual Studio commands

    Getting ready

    How to do it…

    There's more…

    Searching and navigating

    Getting ready

    How to do it…

    There's more…

    Quickly searching your code

    Navigating in depth

    Getting ready

    How to do it...

    How it works…

    There's more...

    Navigation behavior

    CSS, HTML, and JavaScript files

    2. Getting Started with Universal Windows Platform Apps

    Introduction

    Enabling UWP app development on Windows 10

    Getting ready

    How to do it…

    How it works…

    There's more…

    Creating a UWP app

    Getting ready

    How to do it...

    How it works…

    There's more…

    Choosing the right project type…

    Blank App

    Class Library

    Windows Runtime Component

    Unit Test App

    Coded UI Test Project (Windows Phone)

    Coded UI Test Project (Windows)

    C++ specific UWP templates

    Language interoperability

    Customizing your UWP app

    Getting ready

    How to do it...

    How it works…

    There's more…

    SplitView

    RelativePanel

    CalendarView

    CalendarDatePicker

    MediaTransportControls

    See also

    Using the UWP app simulator

    Getting ready

    How to do it…

    How it works…

    There's more…

    Resolution and resizing

    Change network properties

    Remote debugging

    Taking screenshots

    Fresh app install

    See also

    Defining capabilities and contracts

    Getting ready

    How to do it...

    How it works…

    There's more…

    Declarations

    Background tasks

    Update task

    Search contract

    File Type Associations

    Certificates

    Capabilities

    Internet (Client)

    Internet (Client & Server)

    Home or work networking

    Library access

    See also

    Analyzing your app's performance

    Getting ready

    How to do it…

    How it works…

    There's more…

    Packaging your UWP app

    Getting ready

    How to do it...

    How it works…

    There's more...

    See also

    Validating your Windows Store app

    Getting ready

    How to do it…

    How it works...

    See also

    Submitting your app to the Windows Store

    Getting ready

    How to do it…

    How it works...

    There's more…

    See also

    Distributing your UWP app through sideloading

    Getting ready

    How to do it…

    How it works…

    There's more…

    See also

    3. Web Development

    Introduction

    Getting started with a Bootstrap-based SPA

    Getting ready

    How to do it…

    There's more…

    See also

    Making the most of Browser Link

    Getting ready

    How to do it…

    How it works…

    There's more…

    Supporting static HTML files

    Adding bundling and minification to JavaScript and CSS files

    Getting ready

    How to do it…

    How it works…

    Managing packages with NuGet

    Getting ready

    How to do it…

    How it works…

    There's more…

    Automatically loading packages

    Using custom package locations

    Fortifying JavaScript applications with TypeScript

    Getting ready

    How to do it…

    How it works…

    There's more…

    Using Visual Studio for Node.js development

    Getting ready

    How to do it…

    How it works…

    There's more…

    See also

    4. .NET Framework Development

    Introduction

    Creating a task-based WCF service

    Getting ready

    How to do it...

    How it works...

    Unit testing .NET applications

    Getting ready

    How to do it…

    How it works…

    There's more…

    Can I restrict the unit tests that automatically execute?

    Asynchronous tests

    Automatically trigger test execution

    See also

    Sharing class libraries across different runtimes

    Getting ready

    How to do it...

    How it works...

    Viewing defined targets

    There's more…

    Detecting duplicate code

    Getting ready

    How to do it…

    How it works...

    There's more…

    Exploring C# through the Immediate window

    Getting ready

    How to do it…

    How it works…

    There's more…

    5. Debugging Your .NET Application

    Introduction

    Putting Diagnostic Tools to work

    Getting ready

    How to do it…

    How it works...

    There's more…

    See also

    Maximizing everyday debugging

    Getting ready

    How to do it…

    There's more…

    Debugging on remote machines and tablets

    Getting ready

    How to do it...

    How it works...

    There's more…

    Debugging an ASP.NET process

    Deploying directly to a remote machine

    Missing symbols

    Debugging code in production with IntelliTrace

    Getting ready

    How to do it...

    How it works...

    Is your application in break mode?

    There's more…

    Finding the variable values

    Debugging parallel code

    Getting ready

    How to do it…

    How it works…

    See also

    Visualizing concurrency

    Getting ready

    How to do it...

    How it works...

    See also

    6. Asynchrony in .NET

    Introduction

    Making your code asynchronous

    Getting ready

    How to do it...

    How it works...

    There's more…

    See also

    Understanding asynchrony and Universal Windows Platform apps

    Getting ready

    How to do it...

    How it works...

    Using asynchrony with web applications

    Getting ready

    How to do it...

    How it works...

    There's more…

    See also

    Working with actors and the TPL Dataflow library

    Getting ready

    How to do it...

    How it works...

    There's more…

    See also

    7. Unwrapping C++ Development

    Introduction

    Using XAML with C++

    Getting ready

    How to do it...

    How it works...

    There's more…

    Unit testing C++ applications

    Getting ready

    How to do it...

    How it works...

    There's more…

    Debugging unit tests

    See also

    Analyzing your C++ code

    Getting ready

    How to do it…

    How it works…

    There's more…

    Selecting Active ruleset

    Improving C++ source navigation speed

    See also

    Using a custom ruleset

    Getting ready

    How to do it…

    How it works…

    There's more…

    Edit and Continue C++ style

    Getting ready

    How to do it...

    How it works…

    Working with DirectX in Visual Studio 2015

    Getting ready

    How to do it...

    How it works...

    There's more…

    Is managed DirectX supported?

    See also

    Creating a shader using DGSL

    Getting ready

    How to do it…

    How it works...

    See also

    Creating and displaying a 3D model

    Getting ready

    How to do it...

    How it works...

    There's more…

    See also

    Using the Visual Studio Graphics Diagnostics

    Getting ready

    How to do it...

    How it works...

    There's more…

    8. Working with Team Foundation Server 2015

    Introduction

    Creating a new TFS project

    Getting ready

    How to do it…

    How it works…

    There's more…

    See also

    Managing your work

    Getting ready

    How to do it...

    How it works...

    There's more…

    Using Favorites

    Shelving active work

    Suspending active work

    See also

    Using local workspaces for source control

    Getting ready

    How to do it...

    How it works...

    There's more…

    Viewing or changing local workplace settings

    See also

    Performing code reviews

    Getting ready

    How to do it...

    How it works...

    See also

    Getting feedback from your users

    Getting ready

    How to do it...

    How it works...

    Using Git for source control

    Getting ready

    How to do it...

    How it works...

    There's more...

    Staging files

    Looking ahead

    See also

    Taking Advantage of Git's command line

    Getting ready

    How to do it...

    How it works…

    There's more…

    9. Languages

    Introduction

    Fortifying JavaScript applications with TypeScript

    Getting ready

    How to do it…

    How it works…

    There's more…

    Integrating Python into Visual Studio

    Getting ready

    How to do it…

    How it works…

    There's more…

    Integrating Python with .NET

    Getting ready

    How to do it…

    How it works…

    Targeting Linux with Visual Studio 2015

    Getting ready

    How to do it…

    How it works…

    There's more…

    10. Final Polish

    Introduction

    Creating installer packages with InstallShield LE

    Getting ready

    How to do it…

    How it works...

    See also

    Creating custom installer packages

    Getting ready

    How to do it...

    How it works...

    There's more…

    Submitting UWP apps to the Windows Store

    Getting ready

    How to do it...

    How it works...

    There's more…

    See also

    Creating Visual Studio add-ins and extensions

    Getting ready

    How to do it...

    How it works…

    There's more…

    Creating your own snippets

    Getting ready

    How to do it...

    How it works...

    There's more…

    Index

    Visual Studio 2015 Cookbook Second Edition


    Visual Studio 2015 Cookbook Second Edition

    Copyright © 2016 Packt Publishing

    All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

    Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.

    Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

    First published: March 2014

    Second edition: August 2016

    Production reference: 1110816

    Published by Packt Publishing Ltd.

    Livery Place

    35 Livery Street

    Birmingham B3 2PB, UK.

    ISBN 978-1-78588-726-0

    www.packtpub.com

    Credits

    Author

    Jeff Martin

    Reviewer

    Ahmed Ilyas

    Commissioning Editor

    Edward Gordon

    Acquisition Editor

    Denim Pinto

    Content Development Editor

    Anish Sukumaran

    Technical Editor

    Sunith Shetty

    Copy Editor

    Sonia Mathur

    Project Coordinator

    Izzat Contractor

    Proofreader

    Safis Editing

    Indexer

    Tejal Daruwale Soni

    Graphics

    Abhinash Sahu

    Production Coordinator

    Aparna Bhagat

    Cover Work

    Aparna Bhagat

    About the Author

    Jeff Martin has been a contributing writer for InfoQ (http://www.infoq.com) for over four years, focusing on .NET and Microsoft-based platforms. Experienced in writing, testing, and designing software, he enjoys learning about new technologies and explaining them to a broader audience. You can follow his work at InfoQ as .NET lead editor.

    I would like to express my sincere gratitude to my wife, Carolyn, for her support and encouragement as I set out to write another book. Additionally, I would like to thank the team at Packt Publishing for their efforts to make this book a success.

    About the Reviewer

    Ahmed Ilyas has a BEng degree from Napier University in Edinburgh, Scotland. He has majored in software development and has 17 years of professional experience in the field.

    After leaving Microsoft, he ventured into setting up his own consultancy company, which offers the best possible solutions for a multitude of industries and provides real-world answers to those problems. He uses the Microsoft stack to build these technologies and to bring in the best practices, patterns, and software to his client base to enable long-term stability and compliance in the ever-changing software industry, improve software developers around the globe, pushing the limits in technology, and to enable the developers to better themselves.

    This has been awarded the MVP in C# by Microsoft thrice for providing excellence and independent real-world solutions to problems faced by developers.

    With 90% of the world using at least one form of Microsoft technology, his motivation and inspiration come from the breadth and depth of knowledge he has obtained from his research and the valuable wealth of information and research at Microsoft.

    He has worked for a number of clients and employers. The reputation that he has earned has resulted in him having a large client base for his consultancy company, Sandler Ltd (UK) and Sandler Software (USA). His client base includes clients from different industries, ranging from digital media to medical and beyond. Some of his clients have included him on their approved contractors/consultants list; these include ICS Solution Ltd, who have placed him on their DreamTeam portal, and CODE Consulting/EPS Software (www.codemag.com) based in the USA.

    Previously, he has contributed as a reviewer to books by Packt Publishing and wishes to thank them once again for this great opportunity.

    I would like to thank the author and publisher of this book for giving me the great honor and privilege of reviewing this book. I would also like to thank my client base and, especially, Microsoft Corporation and my colleagues over there for enabling me to become a reputable leader as a software developer in the industry, which is my joy, passion, and pride.

    www.PacktPub.com

    eBooks, discount offers, and more

    Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at for more details.

    At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.

    https://www2.packtpub.com/books/subscription/packtlib

    Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books.

    Why subscribe?

    Fully searchable across every book published by Packt

    Copy and paste, print, and bookmark content

    On demand and accessible via a web browser

    Preface

    The release of the Visual Studio 2015 Cookbook marks the third edition of a book series devoted to provide the reader with an informative tour of how Visual Studio 2015 (VS2015) can make your development work easier. This newest release of Visual Studio demonstrates Microsoft's renewed drive to make the best programming tools it can, regardless of the device and platforms that a developer is targeting. If that target happens to run Windows, then all the better—but it is no longer a hindrance if it does not.

    This book is significantly updated and rewritten so that the reader can make use of the incredible array of new tools and devices supported by VS2015. With the greater number of platforms supported, it can be easy to overlook the new features offered in VS2015. One of the main goals of this book is to show developers the new ways in which they can put VS2015 to work in their daily development.

    This book will begin by providing a guided tour of the main editor windows used in VS2015, which should be of interest to all users regardless of their desired language. After that, the book will show how different platforms can get work done faster with VS2015, whether it is for web programming, .NET, or classic C++ application development.

    VS2015 lets you use the languages you are comfortable with while you target the platforms needed to support your customers. Taking advantage of the information provided in this book will help you maximize the tools VS2015 provides.

    Choosing the right version of Visual Studio 2015

    With V2015, Microsoft has greatly simplified the different offerings it provides. If you work on open source projects or independent developers, Visual Studio Community 2015 is free of charge and probably your best choice. Professional developers working in corporate settings or larger software companies should choose between Visual Studio Professional and Visual Studio Enterprise. If the price is of no concern, then Enterprise is a better choice as it includes all the available features. Note that Visual Studio Premium is no longer available for VS2015.

    Tip

    Different editions of VS2015 can be installed side by side, so feel free to install any/all of the above as needed for your work.

    What this book covers

    Chapter 1, Exploring Visual Studio 2015, starts us off by taking a tour of the new features found in the editor itself. VS2015 makes some key refinements, and this chapter covers them all, ranging from logging in to project navigation.

    Chapter 2, Getting Started with Universal Windows Platform Apps, examines the development process for UWP apps for Windows 10 powered systems. The full process of obtaining a developer license to build, test, and publish an app is covered here.

    Chapter 3, Web Development, covers several areas of web development and how VS2015 can assist you. Here, we'll cover the multi-browser preview, as well as editor enhancements that can benefit HTML5, CSS, and JavaScript programmers.

    Chapter 4, .NET Framework Development, focuses on developing applications that run on .NET. Desktop application development is still a key market, and this chapter shows different ways in which VS2015 can help.

    Chapter 5, Debugging Your .NET Application, profiles the various ways to debug your .NET-based code. This includes dealing with troubleshooting the code running on a device other than your development workstation.

    Chapter 6, Asynchrony in .NET, deals with the use of asynchronous code to provide more responsive applications and discusses how it may benefit your applications.

    Chapter 7, Unwrapping C++ Development, tackles the elder statesman of languages served by VS2015. Several recipes are provided to benefit your C++ usage—some of the areas covered include unit testing, DirectX, and the Visual Studio Graphics Debugger.

    Chapter 8, Working with Team Foundation Server 2015, describes how Team Foundation Server can benefit your productivity. As modern source control continues to evolve, information on using Git is included.

    Chapter 9, Languages, takes a moment to look at some languages other than .NET and C++, which include TypeScript and Python. Python has a long and successful history, and it is now a first-class citizen of Visual Studio. A new capability for VS2015 is Linux-based targets, and this is also explored here.

    Chapter 10, Final Polish, in this final chapter, we will cover some ways to extend Visual Studio's abilities, and we will get your app ready for consumption by end users.

    What you need for this book

    To follow the recipes in this book, you will need a copy of Visual Studio 2015. Some of the features covered in the recipes may only be available in specific editions of Visual Studio. Thanks to Microsoft's new product lineup, most of the recipes are compatible with the freely available Visual Studio Community. It will be noted if a given recipe has additional requirements.

    If you wish to follow one of these recipes, and you do not have the right edition, trial versions for premium versions can be downloaded from the Microsoft website, which enables you to check whether a particular feature will benefit your project.

    For any of the recipes that deal with Universal Windows Platform (UWP) applications, you will need to use Windows 10 as your operating system.

    Who this book is for

    If you already know your way around the previous versions of Visual Studio, if you are familiar with Microsoft development, and if you're looking to quickly get up to speed with the latest improvements in the 2015 edition of Microsoft's number one development tool, this book is for you.

    If you are an experienced developer who has used Eclipse or XCode, you should also be able to find this book useful to explore the differences between your tools and the latest ones that Microsoft has to offer.

    Sections

    In this book, you will find several headings that appear frequently (Getting ready, How to do it, How it works, There's more, and See also).

    To give clear instructions on how to complete a recipe, we use these sections as follows:

    Getting ready

    This section tells you what to expect in the recipe, and describes how to set up any software or any preliminary settings required for the recipe.

    How to do it…

    This section contains the steps required to follow the recipe.

    How it works…

    This section usually consists of a detailed explanation of what happened in the previous section.

    There's more…

    This section consists of additional information about the recipe in order to make the reader more knowledgeable about the recipe.

    See also

    This section provides helpful links to other useful information for the recipe.

    Conventions

    In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

    Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: We can include other contexts through the use of the include directive.

    A block of code is set as follows:

    var http = require('http')

    var finalhandler = require('finalhandler')

    var serveStatic = require('serve-static')

    When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

    class BankVault

    {

      public:

      BankVault();

      ~BankVault();

      int AddFunds(int amount);

      void StageHeist();   int CurrentFunds();

     

    };

    Any command-line input or output is written as follows:

    print('Hello World') a=32 b=64 print(Results: + (b+a))

    New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: The arrow in the following screenshot indicates where the Sign in option is located.

    Note

    Warnings or important notes appear in a box like this.

    Tip

    Tips and tricks appear like this.

    Reader feedback

    Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

    To send us general feedback, simply e-mail <feedback@packtpub.com>, and mention the book's title in the subject of your message.

    If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

    Customer support

    Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

    Downloading the color images of this book

    We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from https://www.packtpub.com/sites/default/files/downloads/VisualStudio2015CookbookSecondEdition_ColorImages.pdf.

    Errata

    Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

    To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

    Piracy

    Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

    Please contact us at <copyright@packtpub.com> with a link to the suspected pirated material.

    We appreciate your help in protecting our authors and our ability to bring you valuable content.

    Questions

    If you have a problem with any aspect of this book, you can contact us at <questions@packtpub.com>, and we will do our best to address the problem.

    Chapter 1. Exploring Visual Studio 2015

    In this chapter, we will cover the following topics:

    Synchronizing settings

    Touring the VS2015 IDE

    Managing the editor windows

    Finding Visual Studio commands

    Searching and navigating

    Navigating in depth

    Introduction

    The user interface in Visual Studio 2015 (VS2015) is very similar to that of Visual Studio 2013 (VS2013) from an appearance standpoint. However, existing users will still want to browse this chapter to make sure they don't overlook subtle changes. New users will want to read this chapter carefully so that they are able to easily navigate the Integrated Development Environment (IDE).

    The goal of this chapter is to provide all users of VS2015 with the various tools that will benefit developers working on any project type. Having an in-depth familiarity with the IDE will make learning the language-specific functionality much easier.

    Synchronizing settings

    Given the prevalence of cloud computing, and the central role the Internet has in daily life, it should be no surprise that nearly all Microsoft products utilize some form of an online account, and VS2015 is no exception. If you have an MSDN account, Microsoft recommends that you use it to log in to Visual Studio. If you don't have one, or would prefer to use

    Enjoying the preview?
    Page 1 of 1