Share via


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

  1. 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).

  2. Log on to the build server.

  3. 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:

    See Installing Visual Studio.

  4. From Windows Start, run Team Foundation Server Administration Console.

    The Team Foundation Server Administration Console appears.

  5. 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.

Build Server Administration Console

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.

  1. 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.

  2. The Build Agent Properties dialog box appears.

  3. Under Tags, choose the Add new tag link.

    The Add New Tag dialog box appears.

  4. Specify a tag, such as WindowsStore.

  5. Choose OK.

Tag the build agent

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.

  1. Identify a user account (not NETWORK SERVICE) that you will use as the build service account. The build service account must meet these criteria:

  2. Log on to the build server with your build service account credentials.

  3. In the Build Configuration node of the Team Foundation Server Administration Console, choose Properties.

    Select Properties

    The Build Service Properties dialog box appears.

    Run the build service as an interactive process

  4. Choose Stop the service.

  5. Under Run the Service as, choose Change, and then specify the credentials to your build service account.

  6. Select Run the Service interactively.

  7. Choose Start, and then choose OK.

  8. 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.

  1. On the build agent computer, run Visual Studio.

  2. On the menu bar, choose File, New, Project.

  3. On the New Project dialog box, select one of the Visual C# Windows Store app templates.

  4. Choose OK.

    The system prompts you to install a developer license.

    Get a developer license for Windows

  5. If the User Account Control dialog box appears, choose Yes.

  6. Sign in with your Microsoft account.

  7. The Developer License confirmation dialog box appears.

    Windows developer license confirmation

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

  1. 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.

  2. The Create App Package wizard appears.

    Create App Package

    Select No.

  3. Specify the package settings.

    Create App Package Step 2

    Select at least one platform and choose Create.

  4. Your package is created.

    Your packages have been 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.

  1. On your dev machine, locate .cer certificate that you generated in the previous section.

    1. In Source Control Explorer, navigate to the folder that contains the test project.

      Test project in Source Control Explorer

      Choose the Local Path link.

    2. Navigate to the AppPackages folder and then to the sub-folder that contains the package you created.

      Folder that contains the .cer certificate

  2. Copy the .cer certificate from your dev machine to the build agent computer.

  3. On the build agent computer, from Windows Start, run Command Prompt as administrator.

  4. In the Administrator: Command Prompt window, enter certutil -addstore root certficate_file where certficate_file is the path to a certificate file.

    Certutil

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

  1. In Team Explorer:

    1. If you are not already connected to the team project that you want to work in, then connect to the team project.

    2. Choose Home iconHome, and then choose Builds IconBuilds.

    3. On the Builds page, choose New Build Definition.

    A new build definition window appears.

  2. 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.

  3. 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.

  4. 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.

  5. On the Process tab:

    1. 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.

    2. 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.

  6. If you want to run automated unit tests, follow these steps on the Process tab:

    1. Expand the Basic node.

    2. Select the Automated Tests check box, and then choose the ellipsis button (...).

      The Automated Tests dialog box appears.

    3. 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.

    4. On the Test runner menu, choose Visual Studio Test Runner.

    5. In the Test assembly file specification box, type **\*test*.appx.

    6. For information about other settings, see Run Tests in Your Build Process.

  7. 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.