Azure DevOps - Compile with .NETCore 3
Since few days Microsoft released the final version of .NETCore 3.0.
How to develop with .NET Core 3.0
To use this version, configure your csproj to define the TargetFramework and the parameters of publication : a single file for Win10-x64.
<PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>netcoreapp3.0</TargetFramework> <RuntimeIdentifier>win10-x64</RuntimeIdentifier> <PublishSingleFile>true</PublishSingleFile> <PublishTrimmed>true</PublishTrimmed> </PropertyGroup>
You can publish your project in a single big executable, via the Visual Studio command Publish (right-click on the project).
To my great surprise, I didn’t find this version in the SDKs installed by default in the Azure DevOps Pipelines. The reason and the solution is quite simple: simply add a task to install the SDK of your choice.
In your Build Definition, search for the use .net core task and configure it as follows:
- Package to install : SDK
- Version : 3.x
- Perform Multi Level Lookup: checked (to continue to use 2.2 already installed)