Freigeben über


Build ASP.NET apps with .NET Framework

TFS 2017

Note

In Microsoft Team Foundation Server (TFS) 2018 and previous versions, build and release pipelines are called definitions, runs are called builds, service connections are called service endpoints, stages are called environments, and jobs are called phases.

Note

This article focuses on building .NET Framework projects with Azure Pipelines. For help with .NET Core projects, see .NET Core.

Note

This guidance applies to TFS version 2017.3 and newer.

Create your first pipeline

Get the code

Import this repo into your Git repo in TFS:

https://github.com/Microsoft/devops-project-samples.git

The sample repo includes several different projects, and the sample application for this article is located at:

https://github.com/Microsoft/devops-project-samples

You'll use the code in /dotnet/aspnet/webapp/. Your azure-pipelines.yml file needs to run from within the dotnet/aspnet/webapp/Application folder for the build to complete successfully.

The sample app is a Visual Studio solution that has two projects:

  • An ASP.NET Web Application project that targets .NET Framework 4.5
  • A Unit Test project

Note

This scenario works on TFS, but some of the following instructions might not exactly match the version of TFS that you are using. Also, you'll need to set up a self-hosted agent, possibly also installing software. If you are a new user, you might have a better learning experience by trying this procedure out first using a free Azure DevOps organization. Then change the selector in the upper-left corner of this page from Team Foundation Server to Azure DevOps.

  • After you have the sample code in your own repository, create a pipeline using the instructions in Create your first pipeline and select the ASP.NET template. This automatically adds the tasks required to build the code in the sample repository.

  • Save the pipeline and queue a build to see it in action.

Build environment

Your builds run on a self-hosted agent. Make sure that you have the necessary version of the Visual Studio installed on the agent.

Build multiple configurations

It is often required to build your app in multiple configurations. The following steps extend the example above to build the app on four configurations: [Debug, x86], [Debug, x64], [Release, x86], [Release, x64].

  1. Click the Variables tab and modify these variables:

    • BuildConfiguration = debug, release
    • BuildPlatform = x86, x64
  2. Select Tasks and click on the agent job to change the options for the job:

    • Select Multi-configuration.
    • Specify Multipliers: BuildConfiguration, BuildPlatform
  3. Select Parallel if you have multiple build agents and want to build your configuration/platform pairings in parallel.