I managed to get an automated build of some new code tonight and I ran into some issues which I have now resolved, so here are the steps to create a fully automated build and release of a brand new .net core web app using Visual Studio and Azure DevOps.
Part 1 will cover creating a manual build
- Create a DevOps Organization
- Create a brand new .Net Core Web App in Visual Studio( File, New Project, .Net Core, Asp.Net Core Application)
- Call it anything you like I called my BlogPostDemo
- Choose Web Application (Model-View-Controller)
- Click ok
- Make sure you have the following VS Extension installed – GitHub Extension for Visual Studio
- Then do File -> Add to Source Control
- From Team Explorer select Sync
- Then where it says Push To Azure DevOps -> Click Publish to Git Repo
- Make sure your Azure DevOps Organisation is selected and give the Repository a name e.g. (BlogPostDemo)
- Click Publish
- You should now be able to see this if you click on Repos within Azure Devops
Ok so now we have the code in place, let’s do a build and make sure the code builds within the repo in Azure DevOps. To create a release I did the following:-
- Click on Pipelines and then Builds
- Click new Pipeline
- Be careful here, I selected to use the visual designer which you can see here:-
- Then I left the default choices (Azure Repos Git, BlogPostDemo, BlogPostDemo, master branch), click Continue
- Then I add a ASP.NET Core Template (this gives you Restore, Build, Test, Publish, Publish Artifact steps for you)
- Click Save and Queue
It’s important to note that at this stage the build is going to be a manual build, we will come back to it and make it an automated build (and release) later on.
Part 2 will cover doing a manual Release and in Part 3 we will make the whole thing automated.