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
- add a new Net Core Tool Installer
- tell it to install the SDK version 2.1.300
- 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