Development process for Azure-hosted ASP.NET Core applications

“With the cloud, individuals and small businesses can snap their fingers and instantly set up enterprise-class services.”

Roy Stephan

Vision

Develop well-designed ASP .NET Core applications the way you like, using Visual Studio or the dotnet CLI and Visual Studio Code or your editor of choice.

Development environment for ASP.NET Core apps

Development tools choices: IDE or editor

Whether you prefer a full and powerful IDE or a lightweight and agile editor, Microsoft has you covered when developing ASP.NET Core applications.

Visual Studio 2017. If you’re using Visual Studio 2017 you can build ASP.NET Core applications as long as you have the .NET Core cross-platform development workload installed. Figure 10-1 shows the required workload in the Visual Studio 2017 setup dialog.

 

VS2017WorkloadFigure 10-1. Installing the .NET Core workload in Visual Studio 2017.

 

Download Visual Studio 2017

Visual Studio Code and dotnet CLI (Cross-Platform Tools for Mac, Linux and Windows). If you prefer a lightweight and cross-platform editor supporting any development language, you can use Microsoft Visual Studio Code and the dotnet CLI. These products provide a simple yet robust experience that streamlines the developer workflow. Additionally, Visual Studio Code supports extensions for C# and web development, providing intellisense and shortcut-tasks within the editor.

Download the .NET Core SDK

Download Visual Studio Code

 

Development workflow for Azure-hosted ASP.NET Core apps

The application development lifecycle starts from each developer’s machine, coding the app using their preferred language and testing it locally. Developers may choose their preferred source control system and can configure Continuous Integration (CI) and/or Continuous Delivery/Deployment (CD) using a build server or based on built-in Azure features.

To get started with developing an ASP.NET Core application using CI/CD, you can use Visual Studio Team Services or your organization’s own Team Foundation Server (TFS).

Initial Setup

To create a release pipeline for your app, you need to have your application code in source control. Set up a local repository and connect it to a remote repository in a team project. Follow these instructions:

Create an Azure App Service where you’ll deploy your application. Create a Web App by going to the App Services blade on the Azure portal. Click +Add, select the Web App template, click Create, and provide a name and other details. The web app will be accessible from {name}.azurewebsites.net.

AzureWebApp

Figure 10-2. Creating a new Azure App Service Web App in the Azure Portal.

Your CI build process will perform an automated build whenever new code is committed to the project’s source control repository. This gives you immediate feedback that the code builds (and, ideally, passes automated tests) and can potentially be deployed. This CI build will produce a web deploy package artifact and publish it for consumption by your CD process.

Define your CI build process

Be sure to enable continuous integration so the system will queue a build whenever someone on your team commits new code. Test the build and verify that it is producing a web deploy package as one of its artifacts.

When a build succeeds, your CD process will deploy the results of your CI build to your Azure web app. To configure this, you create and configure a Release, which will deploy to your Azure App Service.

Define your CD release process

Once your CI/CD pipeline is configured, you can simply make updates to your web app and commit them to source control to have them deployed.

Workflow for developing Azure-hosted ASP.NET Core applications

Once you have configured your Azure account and your CI/CD process, developing Azure-hosted ASP.NET Core applications is simple. The following are the basic steps you usually take when building an ASP.NET Core app, hosted in Azure App Service as a Web App, as illustrated in Figure 10-3.

EndToEndDevDeployWorkflow

Figure 10-3. Step-by-step workflow for building ASP.NET Core apps and hosting them in Azure.