Skip to content

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 inTroubleshooting

7 Comments

  1. hema hema

    Thanks Ruben. This solution worked for me.

  2. Perfect, thanks sorted my issue out too. 🙂

  3. Tomas Hesse Tomas Hesse

    Thanks. In my case I edited the agent in the pipeline to run on Windows-2019, was 2016 before
    /Cheers

    • oscar pena oscar pena

      This was the fix for me. Thanks a lot!

  4. Dũng Dũng

    Thanksssssssssss

  5. Carlos Carlos

    man! you are a legend!! Thanks a lot! that fixed my issue as well.

  6. Laurien Laurien

    Gracias!!!

Leave a Reply

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