Preface
The Visual Studio 2013 Cookbook has been written to provide you with an informative tour around Visual Studio 2013 (VS2013). Topics have been broken down into quick-to-access segments called recipes, allowing you to easily find the material that interests you.
Some recipes will directly apply to your regular tasks while others are intended to shed some light on overlooked corners of Visual Studio. Given its long pedigree, extensive functionality has been added over the years, which is easy to overlook. The goal is that by reading this book, you will become more proficient with the tool that you use most as a Windows developer.
This second edition has been revised and expanded to cover the new features of VS2013 so that regardless of whether you are upgrading from VS2012 or are making a bigger step from an earlier version, there will be helpful tips and discussion of this new version. For those of you who purchased the first edition, welcome back, and to our new readers thank you for joining us. Let's get started!
While you were gone
Since the launch of VS2012, Microsoft has released four updates referred to as 2012.1, 2012.2, and so on. Each have added functionality to the original program, and each installed package is cumulative, meaning that only the newest one has to be installed to provide the benefits of all previous updates.
VS2012 Update 1
First and foremost is the ability VS2012.1 provides for C++ developers to target Windows XP clients while using the VS2012 compiler. This is a key ability if you desire to continue compiling applications that run on Windows XP and Vista as well as Windows 7 and 8. JavaScript programmers will appreciate the inclusion of memory profiling and memory analysis tools. SharePoint developers will gain load testing support and the use of SharePoint emulators. Full details are available at http://support.microsoft.com/kb/2797915.
VS2012 Update 2
This update includes ASP.NET and Web Tools 2012.2, unit testing support for Windows Phone, and broader unit testing capabilities for Windows Store apps. 2012.2 includes a host of bug fixes and stability improvements that benefit all areas of the program, right from the debugger to memory leaks in C++ based solutions, and several use cases that would cause the IDE to crash. Full details are available at http://support.microsoft.com/kb/2797912.
VS2012 Update 3
2012.3 primarily provides bug patches and performance improvements. Notable for those using VS2012 and VS2013 concurrently is 2012.3's improved compatibility with VS2013 projects. Several stability fixes were made that among other things prevent crashes in web projects, fix a conflict between VS2012 and VS2010, and correct slowdowns when developing mixed-mode C++ applications. Installing Update 3 provides the ability to install the Microsoft Visual Studio Tools for Git, a popular open source version control system. Full details are available at http://support.microsoft.com/kb/2835600.
VS2012 Update 4
Similar to 2012.3, this update is focused in bug fixes and stability enhancements. As this release coincides with the production release of VS2013, it provides some improved compatibility for sharing projects/solutions between VS2012 and VS2013. Full details are available at http://support.microsoft.com/kb/2872520.
Tip
At the time of this writing, there is no reason to avoid installing the latest update available for VS2012 whether using an Express edition or one of the premium editions. Several meaningful improvements have been made to the product since its original release date that benefit all users. Microsoft provides both a web-based installer and a complete standalone ISO at http://go.microsoft.com/fwlink/?LinkId=301713.
Choosing a version of Visual Studio 2013
Visual Studio comes in several different versions, each with different capabilities and target audiences. In all cases, the minimum supported operating system is Microsoft Windows 7 SP1 on the desktop or Windows Server 2008 R2 SP1 on the server. The two biggest differences of the Visual Studio line-up are between the Express and non-Express (premium) versions. Express editions are offered by Microsoft free of charge, and target a specific type of application development:
Visual Studio Express 2013 for Web: As the name implies, this is appropriate for those seeking to build web-based applications using technologies that include HTML5, CSS, and JavaScript.
Visual Studio Express 2013 for Windows: Probably better titled "…for Windows Store apps", this edition targets Windows Store apps exclusively. HTML5/JavaScript, C#, C++, and Visual Basic are all acceptable choices for app development. An emulator is bundled for testing apps across various devices.
Visual Studio Express 2013 for Windows Desktop: Traditional Windows desktop applications can be created with this edition using C#, C++, or Visual Basic.
Tip
Multiple Express editions can be installed side by side, so you feel free to install any/all of the preceding editions as needed for your work.
The non-Express editions run from Visual Studio Professional 2013 to Visual Studio Ultimate 2013. Ultimate has the entire available functionality, whereas Professional is limited to Peek Definition. One advantage all non-Express editions share is that all possible development types (web, apps, and desktop) are available in a single installation. The non-Express editions are as follows:
Visual Studio Professional 2013: This supports development of all application types and includes the Peek Definition feature.
Visual Studio Premium 2013: In addition to the preceding edition, notable features include project management functionality, coded UI testing for XAML Windows Store 8.1 apps, and C++ Profile Guided Optimization.
Visual Studio Ultimate 2013: In addition to the two preceding editions, notable features include CodeLens, IntelliTrace, Memory Dump Analyzer, and cloud-based load testing.
Visual Studio Test Professional 2013: As its name implies, this edition primarily focuses on testing.
Visual Studio 2013 will make certain options available to you based on the underlying version of Windows that you are running. If you are running Windows 8.1, you will only be able to create new Windows Store applications for Windows 8.1. You will be able to open existing Windows 8 app solutions in VS2013, but not create new ones. You are able to create new Windows 8 apps only with VS2012, but this should be considered a special case given the arrival of Windows 8.1. Windows Store applications cannot be developed with any version of Visual Studio on Windows 7, Windows Server (any version), or previous versions of Windows.
Tip
Picking a version
If you are an independent developer, you will most likely want to download the Express edition(s) that apply to the type of program that you are developing. Express editions can be installed side by side, so there is no need to limit yourself to just one. Among the paid versions, choose which one meets the requirements of your work. If you are not price-limited, picking the Ultimate version is the simplest route. A full comparison of the various versions is available at http://www.visualstudio.com/products/compare-visual-studio-products-vs.
Visual Studio 2013 Update 1 has been released and primarily consists of stability patches and bug fixes. It should be applied to your system regardless of the edition of VS2013 that you have selected. More information about Update 1 is available at http://support.microsoft.com/kb/2911573. As this book goes to print, a preview of Update 2 has been announced. This release will be delivering new features as well bug fixes. Follow this book's Twitter feed for more news as this becomes available (@VSDevTips
) or https://twitter.com/vsdevtips.
What this book covers
Chapter 1, Discovering Visual Studio 2013, starts us off by taking a tour of the new features found in the editor itself and covers all VS2013's key refinements, from logging in to project navigation.
Chapter 2, Getting Started with Windows Store Applications, examines the development process for Windows Store apps for Windows 8.1. The full process of obtaining a developer license to building, testing, and publishing an app is covered.
Chapter 3, Web Development – ASP.NET, HTML5, CSS, and JavaScript, covers several areas of web development and how VS2013 can assist you. Here, the multi-browser preview is covered as well as editor enhancements that can benefit HTML5, CSS, and JavaScript programmers.
Chapter 4, .NET Framework 4.5.1 Development, focuses on developing applications that run on .NET. Desktop application development is still a key market and shows ways VS2013 can help.
Chapter 5, Debugging Your .NET Application, profiles the various ways to debug your .NET-based code. Code isn't always available on your development environment and this profile shows ways to deal with separate machines, whether they are tables or in production.
Chapter 6, Asynchrony in .NET, deals with the use of asynchronous code to provide more responsive output and how it may benefit your applications.
Chapter 7, Unwrapping C++ Development, tackles the elder statesman of languages severed by VS2013. Several recipes are provided, which will benefit your C++ usage; some of the areas covered include unit testing, XAML, and DirectX.
Chapter 8, Working with Team Foundation Server 2013, describes how Team Foundation Server can benefit your productivity. Whether you are an independent developer or part of a large corporate effort, you'll see how modern source control can help.
Chapter 9, Languages, takes a moment to look at some useful languages that are new to Visual Studio: TypeScript and Python. Python has a long and successful history, and now it is a first-class citizen on Visual Studio. We'll take a look at how Python can help .NET developers.
Appendix, Visual Studio Medley, the assortment of preceding topics doesn't cover everything that VS2013 can do. We'll cover some ways to extend Visual Studio's abilities and how to 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 2013. Some of the features covered in the recipes may only be available in specific editions of Visual Studio. Whenever possible, any specific version requirements will be noted.
If you wish to follow one of these recipes and you do not have the right edition, trial versions of the premium versions can be downloaded from the Microsoft website enabling you to see if a particular feature would benefit your project.
For any of the recipes that deal with Windows Store applications, you will need to be using Windows 8.1 as your operating system.
Who this book is for
If you already know your way around 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 2013 incarnation of Microsoft's number one development tool, then 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 for exploring the differences between your tools and the latest that Microsoft has to offer.
Conventions
In this book, you will find a number of styles of text 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: "Open the VS2012_Web
solution and run the application."
A block of code is set as follows:
<appSettings> <add key="vs:enableBrowserLink" value="true"/> </appSettings>
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
Any command-line input or output is written as follows:
Get-Command *intelli*
New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "The Preview Selected Items button is a toggle button."
Keyboard shortcuts such as Ctrl or F4 are formatted as shown.
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 may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.
To send us general feedback, simply send an e-mail to <feedback@packtpub.com>
, and mention the book title through 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 on 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 example code
You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.
Downloading the color images of this book
We also provide you 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/1966EN_ColoredImages.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 would 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/support, 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.
Piracy
Piracy of copyright 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
You can contact us at <questions@packtpub.com>
if you are having a problem with any aspect of the book, and we will do our best to address it.