First we are creating a build pipeline. Go to your Azure DevOps project and click on Pipelines then click on Build
Click on New pipeline
Choose Use the visual designer
Choose your source control, in our case we choose Azure Repos Git, simply because we are using Azure DevOps for source control and MyVeryFirstAPI repo we created in this blog and click on Continue.
Our application is .NET Core application and we choose .NET Core template. Just start writing in the search boxen Core
Choose ASP .NET Core template and click on Apply.
Provide a meaningful name and choose Hosted VS2017 Agent pool. Click on Save & queue.
Click on Save & queue -> Save & queue.
Just click on Save & queue button.
Now we triggered the build with version #20190320.1
When we click on the blue version, we can see how Azure DevOps running our build definition and all logs
You can see here all the logs when steps we defined in the ASP .NET Core build pipeline were executed. And actually som other kind of help steps Azure DevOps executes.
When the build is finished we see the following
All tasks executed successful, except one Publish. Let's take a look at the error message
##[section]Starting: Publish ============================================================================== Task : .NET Core Description : Build, test, package, or publish a dotnet application, or run a custom dotnet command. For package commands, supports NuGet.org and authenticated feeds like Package Management and MyGet. Version : 2.148.1 Author : Microsoft Corporation Help : [More Information](https://go.microsoft.com/fwlink/?linkid=832194) ============================================================================== [command]C:\windows\system32\chcp.com 65001 Active code page: 65001 ##[error]No web project was found in the repository. Web projects are identified by presence of either a web.config file or wwwroot folder in the directory. ##[error]Project file(s) matching the specified pattern were not found. ##[section]Finishing: Publish
Azure DevOps could not find wwwroot folder or web.config. And it is true because ASP .NET Core template generates a folder called wwwroot but it's empty and git just ignore all empty folders. The easiest fix is go to your build definition and click on Publish task
By default ASP .NET Core template assume that you want to build a web application but we can just remove Publish Web Projects because we are creating an API.
It should looks like this
Save and queue again.
Now we are finished with CI for our API. You can take a look at Artifacts folder. Click on it and explore
This is output of your build. Very important for error seeking when something is wrong and behaves strange.
You see also that we get one warning when executed Test task. It's because we didn't created any tests yet. We can ignore the warning or deactivate Test task.
Right click on Test task and choose Disable selected task(s).
It's very good excise to use the visual designer and understand how all this task work but it is much better to user YAML file to define all this graphical tasks.
This blog post explains how to do the same what we did here but with YAML file.