Solved: NETSDK1045: The current .NET SDK does not support targeting .NET Core 3.1.

I recently started working on a new project with .NET Core 3.1 using Azure DevOps as my CI/CD pipeline. I was using an on premise build agent (not hosted) with Visual Studio 2019 and teh .Net Core 3.1 SDK installed on it.

I started getting the following error in the Nuget Restore step when attempting to build the project in Azure Pipelines:

[error]The nuget command failed with exit code(1) and error(C:\Program Files\dotnet\sdk\2.2.402\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(137,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Core 3.1. Either target .NET Core 2.2 or lower, or use a version of the .NET SDK that supports .NET Core 3.1.

After some investigation it turned out I had an old version of Visual Studio 2019 installed on the server which did not support .NET Core 3.1. I updated Visual Studio to the latest version currently available and the issue was resolved.


Published in: Troubleshooting