Build and Test a Windows Store App Using Team Foundation Build
You can use Team Foundation Build to compile and test a Windows Store app, also known as a Windows Store app.
What do you want to do?
Deploy a build agent that can compile Windows Store apps
Deploy the build agent
Apply a tag to the build agent
Enable your build agent to run unit tests
Run the build agent server as an interactive process
Install a Windows 8 developer license
Generate a unit test certificate
Install a unit test certificate
Define a build process that builds and tests Windows Store apps
Deploy a build agent that can compile Windows Store apps
To compile a Windows Store app, your build agent must be running on a build server that meets these criteria:
Runs on Windows 8 (client releases only).
Has Visual Studio 2012 installed.
Required permissions
You must be a member of the Administrators group on the build machine and your Manage build resources permission must be set to Allow. For more information, see Team Foundation Server Permissions.
Deploy the build agent
Complete one of these steps:
Configure a new build server and create a build agent on a computer that is running Windows 8 (client releases only). For more information about deploying a new build server, see Install Team Foundation Build Service.
Locate an existing build server with a build agent on a computer that is running Windows 8 (client releases only).
Log on to the build server.
Install Visual Studio 2012 on the build server. In most cases, you can install the same version of Visual Studio 2012 that your team uses on its dev machines.
In a few cases, you must install Visual Studio Professional 2012, Visual Studio Premium 2012, or Visual Studio Ultimate 2012:
You are building a Visual C++ Windows Store app and you want to build a configuration that includes the x64 Platform.
You want to enable code coverage when you run your tests.
From Windows Start, run Team Foundation Server Administration Console.
The Team Foundation Server Administration Console appears.
In the tree pane, expand the name of the server, and then choose the Build Configuration node.
Information about the build machine appears in the content pane. If the Configure Installed Features link appears, you must complete the initial configuration of the build server. See Install Team Foundation Build Service.
Apply a tag to the build agent
One way to make sure that your build process runs only on a build agent that is capable of compiling and testing Windows Store apps is to apply a tag to the build agents.
In the Build Configuration node of the Team Foundation Server Administration Console, complete one of these steps:
Choose New Agent.
Locate a build agent that you want to use to build your Windows 8 apps, and then choose its Properties link.
The Build Agent Properties dialog box appears.
Under Tags, choose the Add new tag link.
The Add New Tag dialog box appears.
Specify a tag, such as WindowsStore.
Choose OK.
If you need to run unit tests, continue to the next section. Otherwise, you can skip to Define a build process that builds and tests Windows Store apps.
Enable your build agent to run unit tests
You can enable your build agent to run unit tests on your Windows Store app.
Run the build agent server as an interactive process
To run unit tests on your Windows Store app, you must run the build agent as an interactive process.
Identify a user account (not NETWORK SERVICE) that you will use as the build service account. The build service account must meet these criteria:
Have Administrator privileges on the build server computer.
Be registered on your Team Foundation Server as a build service account. See Grant a Build Server Permission to Serve a Team Project Collection.
Have Change and Read privileges on the drop folder, if any, that you plan to specify in your build definition. See Set Up Drop Folders.
Log on to the build server with your build service account credentials.
In the Build Configuration node of the Team Foundation Server Administration Console, choose Properties.
The Build Service Properties dialog box appears.
Choose Stop the service.
Under Run the Service as, choose Change, and then specify the credentials to your build service account.
Select Run the Service interactively.
Choose Start, and then choose OK.
Leave the build service account logged on to the build server.
Install a Windows 8 developer license
To run unit tests on your Windows Store app, you must install a Windows 8 developer license on the build agent. One way to do this is to use Visual Studio to create a Visual C# Windows Store project.
On the build agent computer, run Visual Studio.
On the menu bar, choose File, New, Project.
On the New Project dialog box, select one of the Visual C# Windows Store app templates.
Choose OK.
The system prompts you to install a developer license.
If the User Account Control dialog box appears, choose Yes.
Sign in with your Microsoft account.
The Developer License confirmation dialog box appears.
Also see: Getting a developer license for Windows 8.
Generate a unit test certificate
To run unit tests on your Windows Store app, you must install—on the build agent—a certificate from the code project that contains the unit tests that you want to run. Although you can use the .pfx certificate file that Visual Studio automatically generates, we recommend that you use a .cer certificate file instead. You can use Visual Studio to generate it.
See Walkthrough: Creating and Running Unit Tests for Windows Store Apps and More information on Windows Store app certificates
To use Visual Studio to generate a .cer certificate file
On your dev machine, in Visual Studio, in Solution Explorer, open the shortcut menu of the project that contains your unit tests, and then choose Store, Create App Package.
The Create App Package wizard appears.
Select No.
Specify the package settings.
Select at least one platform and choose Create.
Your package is created.
Install a unit test certificate
On the build agent, you must install the certificate from the code project that contains the unit tests that you want to run.
On your dev machine, locate .cer certificate that you generated in the previous section.
In Source Control Explorer, navigate to the folder that contains the test project.
Choose the Local Path link.
Navigate to the AppPackages folder and then to the sub-folder that contains the package you created.
Copy the .cer certificate from your dev machine to the build agent computer.
On the build agent computer, from Windows Start, run Command Prompt as administrator.
In the Administrator: Command Prompt window, enter certutil -addstore root certficate_file where certficate_file is the path to a certificate file.
Define a build process that builds and tests Windows Store apps
To build (and optionally test) a Windows Store app, you must apply a few settings in your build definition. The following procedure describes how to define a build process that is based on the Default Template.
Required Permissions
To complete the following procedure, you must have the Edit Build Definition permission set to Allow. For more information, see Team Foundation Server Permissions.
To define a build process that builds and tests Windows Store apps
In Team Explorer:
If you are not already connected to the team project that you want to work in, then connect to the team project.
Choose Home, and then choose Builds.
On the Builds page, choose New Build Definition.
A new build definition window appears.
On the Builds page, create a build definition by choosing New Build Definition, or edit a build definition by opening the shortcut menu for the build definition and choosing Edit.
On the Build Defaults tab, select the build controller that pools a build agent that you have deployed to build Windows Store apps, as explained previously in this topic.
Note
You cannot use a Hosted Build Controller to build a Windows Store app.
On the Build Defaults tab, choose one of the following Staging location options to specify how you want the build process to produce and store output files such as compiled binaries and log files:
This build does not copy output files to a drop folder: Choose this option if you do not need output files.
Copy build output to the following drop folder: Choose this option if you want to copy output files to a drop folder on a file share server. In the box, type the UNC file path to the folder where you want the build system to put the output files. You must specify a folder that the build service account (which you specified in Run the build agent server as an interactive process) can read and write. See Set Up Drop Folders.
On the Process tab:
Expand the Required node, expand the Items to Build node, and in the Projects to Build box, specify one or more solutions or projects to build.
Expand the Advanced node, expand the Agent Settings node, and in the Tags Filter box, specify the tag that you applied to build agents that you are using to build Windows Store apps, for example, WindowsStore.
If you want to run automated unit tests, follow these steps on the Process tab:
Expand the Basic node.
Select the Automated Tests check box, and then choose the ellipsis button (...).
The Automated Tests dialog box appears.
Complete one of these steps:
To add a test run, choose Add.
To modify a test run, choose it, and then choose Edit.
The Add/Edit Test dialog box appears.
On the Test runner menu, choose Visual Studio Test Runner.
In the Test assembly file specification box, type **\*test*.appx.
For information about other settings, see Run Tests in Your Build Process.
Specify any other settings that your build process requires. For more information, see Create a Build Definition.
For more information
For more information about developing a Windows Store app, see Learn to build Windows Store apps
For more information about creating and running unit tests on a Windows Store app, see Walkthrough: Creating and Running Unit Tests for Windows Store Apps.