How to get VSTS build working with Asp.Net Core 2.1 SDK?

If you are using the newest preview version of Asp.Net Core 2.1 and if you have tried to make a VSTS to build your project using it you’ve seen that it will fail as VSTS is not having the preview SDK yet available.

2018-04-23T17:52:38.8276956Z    1:5>Target "_CheckForUnsupportedNETCoreVersion" in file "C:\Program Files\dotnet\sdk\2.1.104\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.TargetFrameworkInference.targets" from project "D:\a\1\s\src\api\Oblak.Argus.csproj" (target "CollectPackageReferences" depends on it):
2018-04-23T17:52:38.8277983Z        Using "NETSdkError" task from assembly "C:\Program Files\dotnet\sdk\2.1.104\Sdks\Microsoft.NET.Sdk\build\..\tools\netcoreapp1.0/Microsoft.NET.Build.Tasks.dll".
2018-04-23T17:52:38.8278395Z        Task "NETSdkError"
2018-04-23T17:52:38.8286088Z    1:5>C:\Program Files\dotnet\sdk\2.1.104\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.TargetFrameworkInference.targets(135,5): error : The current .NET SDK does not support targeting .NET Core 2.1.  Either target .NET Core 2.0 or lower, or use a version of the .NET SDK that supports .NET Core 2.1. [D:\a\1\s\src\api\Oblak.Argus.csproj]
2018-04-23T17:52:38.8291136Z        Done executing task "NETSdkError" -- FAILED.

 

VSTS will have it eventually and then the need for this post will be gone but there will more previews and if you are like me you want to work on bleeding edge so this post might still come handy in the future 🙂

The solution to using preview SDK in VSTSis quite simple – all you need to do is to 3 simple steps

  1. add a new Net Core Tool Installer
    .

  2. tell it to install the SDK version    2.1.300
  3. And make that to be the 1st step in the build

Et voila, your VSTS is now working with any .NET Core version you want

CategoriesUncategorized

3 Replies to “How to get VSTS build working with Asp.Net Core 2.1 SDK?”

  1. Hey there – your post really helped – another step which I was missing and which got me out was to make sure the sdk matched in my global.json – ie :

    {
    “sdk”: {
    “version”: “2.1.300-preview2-008530”
    }
    }

Leave a Reply

Your email address will not be published. Required fields are marked *