Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Visual Studio 2013 Cookbook
Visual Studio 2013 Cookbook

Visual Studio 2013 Cookbook: Understanding the latest features of Visual Studio can speed up and streamline your projects. And there's no better learning tool than this collection of focused recipes that gives you the fast, hands-on experience you need.

eBook
Can$34.98 Can$49.99
Paperback
Can$61.99
Subscription
Free Trial

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
Table of content icon View table of contents Preview book icon Preview Book

Visual Studio 2013 Cookbook

Chapter 2. Getting Started with Windows Store Applications

In this chapter, we will cover:

  • Getting a Windows Store app developer license

  • Creating a Windows Store app

  • Adding a Windows Store item template to your app

  • Using the Windows Store app simulator

  • Defining capabilities and contracts

  • Analyzing your App's performance

  • Packaging your Windows Store app

  • Validating your Windows Store app

Introduction


The appearance of the Windows Runtime (WinRT) brought forth a lot of attention when it was introduced as part of the shift in focus to Windows 8. Since the general availability of Windows 8-based systems and the OS itself, there is an opportunity to see first hand what the runtime meant. Essentially, Microsoft felt the need to advance the state of Windows application development by providing a new platform that recognized the rise of non-PC-based devices, touch interfaces, and to combine that with a method to obtain safe and secure Windows applications. WinRT abstracts away the underlying hardware, minimizes security risks, and prevents developers from making insecure or poorly performing calls via the traditional Windows API.

What WinRT offers developers familiar with Windows-based tools is the ability to easily create secure apps that run on Windows 8-based systems. Your users benefit from a straightforward shopping, purchasing, and installation process. As a developer, you...

Getting a Windows Store app developer license


In order for your local Windows apps to be run on your local developer machine, you will need a developer license. Note that this license is free and different from a developer account. The license allows you to develop and test Windows Store apps on your local developer machine. The account is used in conjunction with distributing your app through the Windows Store. There is no cost to obtain a license; it is merely used by Microsoft to track who is developing Windows Store apps. Conversely, a fee is charged by Microsoft to obtain a developer account.

A developer license is required because there would be security implications if a malicious Store app was distributed independent of Microsoft's ability to verify its safety. Consequently, each machine or device that you intend to test your app on must have its own developer license.

In this recipe, we will cover obtaining the developer license needed so that you can get started with writing Windows...

Creating a Windows Store app


We'll begin by creating a basic Windows Store app that uses JavaScript/HTML. For this example, we will use the Hub app template.

Getting ready

Ensure that you are running Windows 8.1 in order to have the ability to create a new Windows Store app. You may use Visual Studio Express 2013 for Windows or one of the premium versions of VS2013 (Professional/Premium/Ultimate).

How to do it…

There are several types of app templates available, but we will start with the Hub style as follows:

  1. From Visual Studio's File menu, navigate to New | Project....

  2. A dialog of available project templates will appear. From the Installed templates category, navigate to the JavaScript | Windows Store | Hub App template. A preview of the app layout will appear in the details pane as shown in the following screenshot:

  3. Leave the name as the default and click on OK to create the app.

  4. The project will appear in Solution Explorer and the default.js file will be open in the document area.

  5. Press F5 to...

Adding a Windows Store item template to your app


Unless you're building a "Hello World" app, you're probably going to want to add more code files and assets to your project than are provided with the standard project templates. Since Microsoft wants Windows Store apps to not only offer great functionality, but to also meet the Windows Store design principles, it has provided a number of ready-made item templates for you to use as part of your development effort.

User interface item templates come with a common look and feel and subtle animations, so your app behaves like other Windows Store apps. Contract templates provide you with the boiler plate code and UI for building Windows 8 Contract support into your app.

In this recipe, you'll see how to use an item template to add functionality to a Windows Store app.

Getting ready

Create a new blank Windows Store app using C# by following the steps in the previous recipe, Creating a Windows Store app.

How to do it...

In order to use an item template...

Using the Windows Store app simulator


You may recall that one of the design goals of Windows Store apps was that they should run equally well on a multitude of devices, including tablets and other touch-enabled devices and they should also support a number of different views such as the Snapped and Full views.

As most developers use powerful desktops or high-end laptops for developing software, these machines exceed the capabilities of many portable devices. They also typically lack some of the other features found in portable devices such as GPS, or gyroscopes. To handle the differences between developer machines and the target devices, Microsoft includes a Windows Store app Simulator with Visual Studio that can be used to test your Windows Store apps without the need of a second physical machine to deploy to.

This recipe will show how to use the simulator to assist in developing your own apps.

Getting ready

Create a new C# based Windows Store project using the Split App (XAML) template and...

Defining capabilities and contracts


Windows 8 provides Windows Store apps with the ability to communicate with any other app on the computer without prior knowledge of what those apps might be through a concept called Contracts. A Contract is an operating system level interface that consumers or providers of information implement. The operating system then keeps track of which apps support which contracts and coordinates the information between apps using those contracts.

Window 8, as part of its focus on improving the trust level in the apps it runs, expects Windows Store apps to communicate the capabilities they need. A Capability is a permission or access right that a Windows Store app requires for it to run correctly, for example, an app that requires Internet access or local network permissions. There is a range of capabilities that the operating system can provide to Windows Store apps. An app that doesn't request capabilities from the operating system will be provided minimum level...

Analyzing your App's performance


Visual Studio 2013 has added additional app performance and diagnostic tools over what was found in VS2012. The Performance and Diagnostics menu provides the following tools:

  • CPU Sampling: This tests what parts of your app are CPU intensive.

  • Energy Consumption: This runs your app to determine how much power it consumes. It is a useful guide to maximize battery life when your app is being run on a portable device.

  • XAML UI Responsiveness: Ensuring your app feels fast to users is critical to its adoption. This tool helps you monitor where your app may need optimization.

Getting ready

For this example, we will continue to use the SplitApp project created in the Using the Windows Store app simulator recipe.

How to do it…

The following are steps to analyze your app's performance:

  1. With SplitApp open, open the Performance and Diagnostics screen. For Visual Studio Express, this is found under the menu Debug | Performance and Diagnostics. For the paid editions (Professional...

Packaging your Windows Store app


For Windows 8 to correctly load and run a Windows Store app, it must be packaged in a particular format. The information contained in the package includes the capabilities and contracts that your app uses as well as information on the app user tile, the splash screen, and more.

This recipe will show you what you need to do to package your Windows Store app so that it is ready for the world to use.

Getting ready

Open the SplitApp project that you created in the Using the Windows Store app simulator recipe.

How to do it...

Perform the following steps for packaging your Windows Store app:

  1. Open the Package.appxmanifest file from Solution Explorer.

  2. Examine the fields in the Application UI tab. Add a space to the Display Name field so that it reads as Split App instead of SplitApp.

  3. Add a useful description in the Description field. For example, A sample app using the Split layout.

  4. Moving to the Visual Assets tab, under the Tile section, confirm the Show name field is...

Validating your Windows Store app


Every app submitted to the Windows Store will be validated by Microsoft before being listed. Part of that validation process involves running the app through an automatic certification tool that Microsoft has included with Visual Studio. You should check that your app passes the certification tool before beginning the Windows Store submission process.

Getting ready

Ensure the SplitApp project you were using in the Packaging your Windows Store app recipe is working correctly and has been deployed.

For the certification process to work, your deployed version must be in the Release mode.

How to do it...

The following steps need to be performed in order to validate your Windows Store app:

  1. From the Windows Start screen, launch the Windows App Cert Kit. The app will prompt for elevation and then start a wizard as shown in the following screenshot:

  2. Select the Validate Windows Store App option. The tool will search for Windows Store apps installed on your machine and list...

Left arrow icon Right arrow icon
Download code icon Download Code

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Mar 17, 2014
Length: 332 pages
Edition :
Language : English
ISBN-13 : 9781782171966
Vendor :
Microsoft
Category :
Languages :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

Publication date : Mar 17, 2014
Length: 332 pages
Edition :
Language : English
ISBN-13 : 9781782171966
Vendor :
Microsoft
Category :
Languages :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just Can$6 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just Can$6 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total Can$ 139.98
Visual Studio 2013 Cookbook
Can$61.99
Visual Studio 2013 and .NET 4.5 Expert Cookbook
Can$77.99
Total Can$ 139.98 Stars icon

Table of Contents

9 Chapters
Discovering Visual Studio 2013 Chevron down icon Chevron up icon
Getting Started with Windows Store Applications Chevron down icon Chevron up icon
Web Development – ASP.NET, HTML5, CSS, and JavaScript Chevron down icon Chevron up icon
.NET Framework 4.5.1 Development Chevron down icon Chevron up icon
Debugging Your .NET Application Chevron down icon Chevron up icon
Asynchrony in .NET Chevron down icon Chevron up icon
Unwrapping C++ Development Chevron down icon Chevron up icon
Working with Team Foundation Server 2013 Chevron down icon Chevron up icon
Languages Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.2
(13 Ratings)
5 star 53.8%
4 star 23.1%
3 star 15.4%
2 star 0%
1 star 7.7%
Filter icon Filter
Top Reviews

Filter reviews by




A. Zubarev Apr 18, 2014
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Oh Visual Studio! A very fast evolving product, who does not use it when developing on a Microsoft platform?I used the one 1st in my life that came in late 90s, it if I remember correctly it offered 3-4 projects.Today, after it went through such an evolution Visual Studio has reached an enormous heights. From ETL to reports, from DirectX to tests, from database projects to Windows Store App development, and what not?A book on Visual Studio makes a lot of sense.Gladly Packt has one off its sleeve that is called Cookbook, in my view these books simply avoid wasting your time. Yet this book is quite universal, if you wish, it will take you through basics as opening a developers` account, or if you do not want to walk baby steps you can jump straight to very advanced topics as say the TPL Dataflow, WPF, Bootstrap and more.I felt the book can be sliced and diced like a multidimensional cube, back and forth without any particular order and all would still make sense. Feel free to pick only the parts you need or like.I enjoyed reading on Python with .Net integration, turned out it is simple.WCF is something I will be doing soon at work, so this book will be revisited gain.The book is full of graphics, coloreful, high quality graphics, very well structured examples, and full of insight, discusses improvements and suggest on best practices.The book also covers working with a workflow, graphics, it was even fun to refresh my C++ skills in Visual Studio 2013 retrospective.In terms of closing, it makes sense to have a printed copy or two, the book must be kept on a bookshelf ready to be borrowed by colleagues. Having it in the eBook format is as helpful as you can search it whenever you need some reference or a refresh. On another note, I wish the book could cover more material as BI, Database, F# development,I am giving this book the maximum mark possible.
Amazon Verified review Amazon
CaroleCronan Jul 09, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Excellent
Amazon Verified review Amazon
Rae J. Owen Apr 03, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Great book very helpful.
Amazon Verified review Amazon
Sergio Costa May 25, 2014
Full star icon Full star icon Full star icon Full star icon Full star icon 5
There’s a lot on this book, not just for those who already know and use Visual Studio and want to learn what’s new with the 2013 version, but also for those that never used it before or are even new to .Net programming. If you are a new .Net programmer, I don’t recommend you get as your first programming book, of course, but I do recommend you get it sometime along your way through your .Net path as a developer. If you are a seasoned developer, you will find a lot of stuff you probably already know but you’ll also certainly be surprised with some nice tips and get to learn a lot of new features shipped with VS2013.I definitely recommend you check Visual Studio 2013 Cookbook whenever you can. If you're serious about developing with Visual Studio, this is a great book to get and you'll certainly find something new to learn.
Amazon Verified review Amazon
Matthew Rowan Apr 28, 2014
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Why would you buy a Visual Studio 2013 book instead of just using the Internet to find what you need? Simple, time and content. The amount of new features and ways to do things in this version is substantial. Mining the Internet you are sure to miss many gems that could make a large difference to your day-to-day work. Going through this book you will benefit that a team of people has done the work for you. Ensuring they have included everything and the content is correct for your easy perusal.Chapter 1 gives a very good overview of the new additions to the main tool you use each day.Chapter 2 gives a very good starting place for Windows 8.1 development. It will get you past the new stuff quickly to allow you to get into the code.Chapter 3 goes over Web Development with MVC 5 and the new One ASP.NET model.Chapter 4 uses some I'm not dead yet WPF ("WPF remains the recommended choice for developing desktop applications on the Windows platform. Visual Studio 2013 itself is a WPF application", p 118) WF, WCF and .NET application development.Chapter 5 Debugging EnhancementsChapter 6 Asynchrony in .NETChapter 7 C++, I skimmed this one, but the C++ developer should be thrilled, and it makes me want to learn DirectX.Chapter 8 Team Foundation Server features from a users perspective. Great features that many developers aren't utilizing that can very much help day-to-day. If you are managing a TFS server though, you'll want more than what is provided here.Chapter 9 is on languages TypeScript, Python and IronPython. TypeScript I knew and understand, but I have no idea about Python, and don't really want to, but it's good to know it's available if that's your flavour of choice.Appendix contains recipes on Installers, Submitting Windows Store apps, Visual Studio Add-ins and extensions, and creating your own snippets.The "There's more..." sections littered throughout are valuable on there own, revealing many power user features I was unaware of. The recipe format of the books make it a great reference to have on-hand. Going to the relevant recipe within the book will be a faster and more reliable process than going online.I intended to flick through this book quickly and dive in on a couple of chapters. I however could not help but go through it all. The capabilities we have available to us, just from Visual Studio is amazing. Going over it all I can't help but think of all the possibilities and opportunities. Now I must get back to coding.Review also posted on my blog [...]Disclaimer: I was provided a complimentary electronic copy of this book by the publisher. In no way was I directed on the content of my review. Opinions are mine alone.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.