Build your .NET app for Windows

Last Update: 4/11/2017

Team Services | TFS 2017 | TFS 2015 | Previous versions (XAML builds)

Are you new to Team Build, Release Management, or CI/CD? If so, we recommend that you first read CI/CD Hello world and then come back here after that.

After you have a Windows build agent, in just a few steps you can define a CI build process that compiles and tests your .NET app whenever your team checks in code.

Define your process

  1. If you haven't already, upload your code to GIT or TFVC.

  2. Create the build definition.

    Build tab

    New Visual Studio build

  3. Specify the code you want to build and select the continuous integration (CI) trigger.

    CI trigger

  4. Save the definition.

    Save button

    Save the build

  5. Queue your new definition to make sure it works.

    Queue the build

    Completed build

Your team now has a CI build to validate every change chcked into your codebase!

Q&A

Should I use the Visual Studio Build step or the MSBuild step?

If you are building a solution, in most cases you should use the Visual Studio Build step. This step automatically:

  • Sets the /p:VisualStudioVersion property for you. This forces MSBuild to use a particular set of targets that increase the likelihood of a successful build.

  • Specifies the MSBuild version argument.

In some cases you might need to use the MSBuild step. For example, you should use it if you are building code projects apart from a solution.

Where can I learn more about MSBuild?

MSBuild step

MSBuild reference

MSBuild command-line reference

How do I build multiple configurations for multiple platforms?

  1. On the Variables tab, make sure you've got variables defined for your configurations and platforms. To specify multiple values, separate them with commas.

    For example, for a .NET app you could specify:

    Name Value
    BuildConfiguration debug, release
    BuildPlatform any cpu

    For example, for a C++ app you could specify:

    Name Value
    BuildConfiguration debug, release
    BuildPlatform x86, x64
  2. On the Options tab select MultiConfiguration and specify the Multipliers, separated by commas. For example: BuildConfiguration, BuildPlatform

    Select Parallel if you want to distribute the jobs (one for each combination of values) to multiple agents in parallel if they are available.

  3. On the Build tab, select this step and specify the Platform and Configuration arguments. For example:

    • Platform: $(BuildPlatform)
    • Configuration: $(BuildConfiguration)

Can I build TFSBuild.proj files?

You cannot build TFSBuild.proj files. These kinds of files are generated by TFS 2005 and 2008. These files contain tasks and targets are supported only using XAML builds.

What other kinds of apps can I build?

Build your app

What other kinds of build steps are available?

Specify your build steps

How do we protect our codebase from build breaks?

How do I modify other parts of my build definition?

I selected parallel multi-configuration, but only one build is running at a time.

If you're using Team Services, you might need more concurrent pipelines. See Concurrent build and release pipelines in Visual Studio Team Services.

How do I see what has changed in my build definition?

View the change history of your build definition

Do I need an agent?

You need at least one agent to run your build or release. Get an agent.

I can't select a default agent queue and I can't queue my build or release. How do I fix this?

See queues.

I use Team Foundation Server on-premises and I don't see some of these features. Why not?

Some of these features are available only on Visual Studio Team Services and not yet available on-premises. Some features are available on-premises if you have upgraded to the latest version of TFS.