Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DevOps hosted pipeline fail to build .NET Core 2.2

With the release of .NET Core 2.2 I expected to be able to build such projects in our Microsoft-hosted DevOps (Azure) pipeline. But the restore step fails, saying 2.2 is not supported:

2018-12-11T14:57:49.0856135Z        "D:\a\1\s\My.Project\My.Project.csproj" (Restore target) (1) ->
2018-12-11T14:57:49.0857867Z        "D:\a\1\s\MyProject.EntityFramework\MyProject.EntityFramework.csproj" (_GenerateRestoreGraphProjectEntry target) (2:3) ->
2018-12-11T14:57:49.0858029Z        (_CheckForUnsupportedNETCoreVersion target) -> 
2018-12-11T14:57:49.0858191Z          C:\Program Files\dotnet\sdk\2.1.402\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(137,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Core 2.2.  Either target .NET Core 2.1 or lower, or use a version of the .NET SDK that supports .NET Core 2.2. [D:\a\1\s\MyProject.EntityFramework\MyProject.EntityFramework.csproj]
2018-12-11T14:57:49.0858287Z 
2018-12-11T14:57:49.0858338Z 
2018-12-11T14:57:49.0858398Z        "D:\a\1\s\My.Project\My.Project.csproj" (Restore target) (1) ->
2018-12-11T14:57:49.0858504Z        "D:\a\1\s\My.Project\My.Project.csproj" (_GenerateRestoreGraphProjectEntry target) (1:5) ->
2018-12-11T14:57:49.0858645Z          C:\Program Files\dotnet\sdk\2.1.402\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(137,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Core 2.2.  Either target .NET Core 2.1 or lower, or use a version of the .NET SDK that supports .NET Core 2.2. [D:\a\1\s\My.Project\My.Project.csproj]

The project builds fine locally, so I think it is most likely that I'm missing something - especially as I come up with nothing on my internet search for similar errors.

Could it really be it is not supported yet?

like image 651
bit0001 Avatar asked Dec 11 '18 15:12

bit0001


People also ask

How do I enable build pipeline in Azure DevOps?

Navigate to your team project on Azure DevOps. Navigate to Pipelines | Pipelines. Not to have two pipelines triggered later in the lab, disable the CI trigger for the template created pipeline (uncheck) and Save. Navigate back to Pipelines | Pipelines and click New pipeline to create a new build pipeline.

Which file is needed by build pipeline for building .NET projects?

Your azure-pipelines. yml file needs to run from within the dotnet/aspnet/webapp/Application folder for the build to complete successfully. The sample app is a Visual Studio solution that has two projects: An ASP.NET Web Application project that targets .


2 Answers

I had the same problem with my pipeline. Here is the solution:

  1. Add to your job (press plus button) in the pipeline task .NET Core SDK Installer. You can search for it in a search box Task adding

  2. Make sure to put that task on the top of your job. You can use drag&drop.

Put .Net SDK on the top

  1. Set up version of .Net Core SDK Installer at least the same your version.

Set up .Net Core SDK

You can see all available version by pressing on the "here" word the in the popup

like image 193
Mykola Kotsabiuk Avatar answered Oct 12 '22 12:10

Mykola Kotsabiuk


OK, so there is a task ".NET Core Installer" that can be added before the Restore task, and by requesting 2.2.100 to be installed first of all the build passes.

like image 40
bit0001 Avatar answered Oct 12 '22 13:10

bit0001