Working with the latest and greatest is always exciting. As developers, we tend to download new software and SDKs in order to try it and, in some cases, benefit from early fixes or early access to new features.
.NET Core 2.1 which was announced at Build is one such example. The first thing I did after the conference announcement was to go on my machine and download it so I could take it for a spin.
However, as developers, we're not restricted to our machines. Eventually, the code is pushed into source control and from there the CI/CD pipeline takes care of the deployment to the appropriate environment(s).
These days I work a lot with VSTS and I have to say that it has some of the best versatility and features when compared to other CI/CD tools. One of the latest innovations added to the build pipeline was around building .NET Core projects.
There are 2 new tasks that allow us to play with the latest builds and previews without needing to deploy private build hosts. Before this change, the only way to build against newer software, not available on the hosted agents, was to deploy a private build agent which usually runs on a VM where the latest software we need is installed.
But this is now a thing of the past. Today, if you want to build a 2.1 .NET Core project, and as you read this a later version, you can use the
.NET Core tool installer
This task downloads a specific version of .NET Core. If you want to ensure that you configure the right version, i.e the one that matches the .NET SDK installed on your machine there are 2 ways to work this out. On the command line you can use the
dotnet --version command:
Alternatively, you can navigate to your
dotnet\sdk directory and get the version from there. Notice that option 1 and option 2 versions should match
With this information at hand, we can go ahead and configure the VSTS task
The second important task we need to add to our build process is the
NuGet Tool Installer
Luckily this task defaults to the latest version so there's no need to configure anything here. Make sure added it in the right position in the build order and you're good to go.
Finally, the build process should look like this for a very basic .NET Core project
With these 2 extra build tasks, the VSTS and .NET Core team have transformed how we build code allowing us to work with cutting-edge features while reducing the overall cost to build and deploy the code. No more private build agents. I feel that developers today have a lot more options and freedom to work with the tools and the stack they love and VSTS is definitely helping