Visual Studio Team Services Support

Computer screen showing a question mark. Community, documentation, and status update solutions.

VSTS status

We are here to help

How to build and deploy ASP.NET Core app to Azure

Build and deploy your ASP.NET Core app to Azure

Last Update: 10/20/2016
Team Services | TFS 2015 | Previous versions (XAML builds) ASP.NET Core is a lean and composable framework for building web and cloud applications. Here we'll show you how to automatically build and deploy your ASP.NET Core app to the Azure cloud.

Upload your code

Upload your code to Visual Studio Team Services or your on-premises Team Foundation Server. Either push your code to Git or check in your code to TFVC. I don't have an ASP.NET Core solution yet. How can I try this out?

Define a simple CI build

This build is useful for making sure your code builds. You can use this kind of definition to build any language.
  1. Open your team project in your web browser ▼
  2. Create a build definition ▼
  3. On the Create new build definition dialog box, select Empty and click Next.
  4. Select the repo, branch, and continuous integration.

Add build steps

On the build tab:
command line Utility: Command Line Restore your project.
  • Tool: dotnet
  • Arguments: restore
command line Utility: Command Line Build your project.
  • Tool: dotnet
  • Arguments: build
  • Advanced, Working folder: Click ... and select the folder that contains the project.json file. For example: WebApplication1/src/WebApplication1
copy files Utility: Copy Files
  • Contents: **/*.dll
  • Target folder: $(Build.ArtifactStagingDirectory)
publish build Utility: Publish Build Artifacts Publish your build artifacts.
  • Path to publish: $(Build.ArtifactStagingDirectory)
  • Artifact name: drop
  • Artifact type: Server

Queue and test the build

Save and queue the build. Once the build is done, click Artifacts and then Explore to see the .DLL file produced by the build.

Define a deployment build

Now define a build you can use to deploy to Azure. This definition uses the Visual Studio Build step, which enables you to later add UI test and database projects, and also to build everything with a single task.

Create the build definition

  1. Open your team project in your web browser ▼
  2. Create a build definition ▼
  3. On the Create new build definition dialog box, select Empty and click Next.
  4. Select the repo, branch, and continuous integration.

Add build steps

On the build tab:
command line Utility: Command Line Restore your project.
  • Tool: dotnet
  • Arguments: restore
VS build Build: Visual Studio Build
  • Solution: **\*.sln
  • Platform: $(BuildPlatform)
  • Configuration: $(BuildConfiguration)
command line Utility: Command Line
  • Tool: dotnet
  • Arguments: publish -c $(BuildConfiguration)
  • Advanced, Working folder: Click ... and select the folder that contains the Web Project. For example: WebApplication1/src/WebApplication1
archive files Utility: Archive Files
  • Root folder to archive:
    {solution folder}/src/{project folder}/bin/
    $(BuildConfiguration)/netcoreapp1.0/publish
    For example:
    WebApplication1/src/WebApplication1/bin/$(BuildConfiguration)/netcoreapp1.0/publish
  • Prefix root folder name to archive paths: Clear
  • Archive type: zip
  • Archive file to create:
    $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
publish build Utility: Publish Build Artifacts Publish your build artifacts.
  • Path to publish: $(Build.ArtifactStagingDirectory)
  • Artifact name: drop
  • Artifact type: Server

Define variables

On the Variables tab:
Name Value
BuildConfiguration release
BuildPlatform any cpu

Queue and test the build

Save and queue the build. Once the build is done, click Artifacts and then Explore to see the .ZIP file produced by the build.

Create a release

After you've run the build, you're ready to create a release to deploy your app on Azure.
  1. In the build summary, under Deployments, click Create release.
  2. Click Yes.
  3. Select Azure Website Deployment.
  4. Click Next.
  5. Select the Continuous Deployment check box.
  6. Click Create.
    • Azure Subscription: Select certificated based subscription. If you do not have one click Manage and follow these directions: Creating an Azure Service Endpoint with a Certificate.
    • Web App Name: {Name for your site}
    • Web App Location: Select a region near you or your users.
  7. Enter a name for your release definition
  8. Click Save.
  9. Click Release.
  10. Select Create Release.
  11. Select the build we just completed.
  12. Click Create.
  13. Click the release link. For example: "Release Release-1 has been created".
  14. Click Logs to watch the release log
Once the release is complete, you can navigate to your new site running in Azure. For more information, see Release Management.

Q&A

How do I create an ASP.NET Core solution?

  1. Install .NET Core.
  2. In Visual Studio select File -> New -> Project.
  3. Select .NET Core category under Visual C#.
  4. Select ASP.NET Core Web Application (.NET Core).
  5. Click OK.
  6. Select Web Application.
  7. Click Change Authentication.
  8. Select No Authentication.
  9. Click OK.
  10. Make sure Host in the cloud is unchecked.
  11. Click OK.
  12. Upload your code to Visual Studio Team Services or your on-premises Team Foundation Server. Either push your code to Git or check in your code to TFVC.

How do I continually deliver my app and manage my releases?

Learn about Release Management

Do I need a build agent?

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

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

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

Where is the Visual Studio 2013 XAML build documentation?

Visual Studio 2013 XAML build documentation

🗨 Need a fast response? Chat with our support bot

Bot is currently in beta and can help answer configuration, build, and release questions. Help us improve the experience by answering the survey after your chat.

Contact us!