Develop Windows Store apps using Visual Studio 2012

159 out of 219 rated this helpful - Rate this topic

[This topic is featured in Develop great apps for Windows 8.]

Microsoft Visual Studio 2012 is a collection of tools that you can use to create, code, debug, localize, package, and deploy a Windows Store app. In short, Visual Studio can help you do just about anything you need to do to develop a Windows Store app.

If you haven't used Visual Studio before, take a quick look around before you start writing code. Visual Studio has a lot of parts, but you don't need to know all about them to get started. After describing the basic steps of setting up a new project, we take a look at the Code Editor and other Visual Studio features.

Important  

  • If you haven't installed Microsoft Visual Studio Express 2012 for Windows 8 yet, go here to download and install the tools.
  • Windows Store app development in Visual Studio is supported only on Windows 8. Windows 7 is not supported. In addition, developer licenses aren't available for Windows Server 2012, so you can't develop Windows Store apps on that operating system.

Getting a developer license

You must have a developer license to develop and test Windows Store apps before the Windows Store can certify them.

When you run Visual Studio for the first time, it prompts you to obtain a developer license. Read the license terms and then click I Accept if you agree. In the User Account Control (UAC) dialog box, click Yes if you want to continue.

For more info about developer licenses, see Get a developer license.

Creating a project and choosing a template

When you create an app, the first thing you need to do is decide which language to use. You can choose JavaScript, Visual Basic, Visual C#, or Visual C++.

To create a project for a Windows Store app, click File > New Project (or press Ctrl+Shift+N). You'll see the New Project dialog box. Click one of the language nodes in the left pane. You'll see various app templates in the center pane. Some important templates, like Blank App, Grid App, and Split App, are shared between all four programming languages. A few templates are language-specific. For more info about the default project templates, see Templates to speed up your app development.

When you create a project for a Windows Store app, Visual Studio creates a solution, which is a way of managing the various source elements of your project (code files, images, style sheets, settings, and so on). A solution container can contain multiple projects, and a project container typically contains multiple items that represent the references, folders, and files that you need to create your app.

Solution Explorer displays solutions, their projects, and the items in those projects. In Solution Explorer, you can open files for editing, add new files to a project, and view solution, project, and item properties. Here's what Solution Explorer looks like for a JavaScript project:

Solution Explorer

In addition to source code files appropriate to the language, each project also includes the package.appxmanifest file, which describes the app package for Windows. Each project also includes several image files, like splashscreen.png for the splash screen image and storelogo.png, which is used for Windows Store. A project source certificate (.pfx) file that's required for signing the package is also included in each project.

Designing a user interface

When you plan your user interface, it's important to select the most appropriate Visual Studio project template for a starting point, and to learn about adding re-usable item templates such as Search contracts. You can develop your UI by writing code or by using a visual designer. A visual designer provides a designer-oriented interface for app design that includes a drag-and-drop interface for building the UI.

For Windows Store apps, you can use the visual designer provided in Blend for Microsoft Visual Studio 2012 for Windows 8. You can open a Visual Studio project in Blend by right-clicking the project in Solution Explorer and clicking Open in Blend. Alternatively, open the solution file (.sln) from within Blend.

XAML Designer in Visual Studio

Updating the app manifest

You can use the Manifest Designer in Visual Studio to edit the app manifest file that describes your app package. The app manifest file is present in Windows Store apps written in all languages. The Manifest Designer has five tabs:

  • Application UI. Configure UI settings, including the logo, splash screen, and initial orientation.
  • Capabilities. Specify system features or devices that your app can use, such as Internet access, current location, and music library access.
  • Declarations. Add declarations for app contracts, like search and share target contracts, and specify their properties.
  • Content URIs. Specify URIs that your app either can or can't access. This tab appears only for JavaScript projects.
  • Packaging. Set properties that identify and describe your package when it is deployed.

For more info about the app manifest settings, see Manifest Designer.

To open the Manifest Designer, double-click the package.appxmanifest file in Solution Explorer, or right-click the file and click View Designer. The Capabilities tab of the Manifest Designer is shown here:

Capabilities tab of the Manifest Designer

Writing code

Visual Studio Express 2012 for Windows 8 includes full-featured editors for the following languages: JavaScript, HTML/XML/XAML, CSS, C#, Visual Basic, C++, HLSL. The editors provide many language-specific features that you can customize to help create your app:

  • IntelliSense, which provides features such as statement completion and parameter Help as you type code. This illustration shows a member list in the C# Code Editor. Note that the list also displays a Quick Info box for the selected item.

    IntelliSense member list

    Tip  The IntelliSense for JavaScript has been improved in Visual Studio Express 2012 for Windows 8, and includes new features like support for standard JavaScript comments and customized IntelliSense results. For more information about JavaScript IntelliSense, see What's New in Visual Studio 2012 and JavaScript IntelliSense.

  • Code snippet insertion, available by right-clicking in a code file and clicking Insert Snippet.
  • Navigation aids like Go To Definition, Bookmarks, and Navigate To.

    The Go To Definition command enables you to find the definition of a class or function by right-clicking the identifier and clicking Go To Definition. (Visual Basic and Visual C++ use the Object Browser to display information about Windows Runtime types.)

    This illustration shows options like Go To Definition and Insert Snippet in the JavaScript Code Editor:

    Features in the Code Editor

    To set and use Bookmarks, click Edit > Bookmarks , or use the shortcut keys shown on the Bookmarks submenu.

    Open the Navigate To window by pressing Ctrl+Comma with the Code Editor open, or by clicking Edit > Navigate To. Navigate To can find symbol definitions and file names in the solution, but not local variables.

  • Outlining, word wrap, displayed line numbers, and other features.

You can customize the behavior of the Code Editors, and enable or disable features like indentation, word wrap, and statement completion. To customize the behavior of the Code Editors, click Tools > Options, expand Text Editor, expand the appropriate Code Editor to configure, and then select the appropriate category of options.

Building an app

To build an app, click Build Solution (or press F7) or Rebuild Solution (or press Ctrl+Alt+F7) on the Build menu. You'll see the results of the build process in the Output window.

Output window

To run your new app in debug mode, click Debug > Start Debugging, or press F5. This runs the app in the host computer by default, but you can choose to run in the simulator or on a remote device. For info about selecting a local or remote host, or the simulator, see Running Windows Store apps from Visual Studio.

To get out of the Windows Store app and switch back to Visual Studio, press Alt+Tab. To stop debugging, click Debug > Stop Debugging, or press Shift+F5.

Packaging and deployment

The package.appxmanifest XML file enables you to configure a deployment package for Windows Store. The Manifest Designer in Visual Studio provides a user interface for configuring the package. You can access the deployment options in the Manifest Designer by double-clicking the package.appxmanifest file in Solution Explorer and then selecting the Packaging tab of the Manifest Designer. For more info, see Manifest Designer.

Localization

To localize a Windows Store app in Visual Studio, we recommend that you add one or more resource files to your project, such as a .resjson file for JavaScript. You can use resource files to specify localized values for string resources that you identify in your app. For more info and tutorials related to localizing, see Globalizing your app.

Debugging and testing

Visual Studio includes a powerful debugger that has many new features to support debugging Windows Store apps. You can debug an app locally, much like you'd debug a Windows desktop app. You can also debug in the simulator on the local machine, or you can debug a remote device connected directly through an Ethernet cable. For general debugging information, see Debugging and testing Windows Store apps. For info about debugging a Windows Store app built for Windows using JavaScript , see Quickstart: Debugging apps (JavaScript) and How to inspect CSS rules.

Next steps

To learn more about creating Windows Store apps, see these topics:

To learn more about developing Windows Store apps by using the Visual Studio templates, see these topics:

For info about new features in Visual Studio, see What's New in Visual Studio 2012.

Related topics

Migrating a Windows Store app to the latest Windows Library for JavaScript
Product Support and Accessibility
Accessibility in Windows Store apps using JavaScript
Accessibility in Windows Store apps (VB/C#/C++ and XAML)

 

 

Build date: 3/11/2013

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.