12

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?

riQQ
  • 9,878
  • 7
  • 49
  • 66
bit0001
  • 555
  • 1
  • 4
  • 12
  • 2
    `2.1.402` there's yer problem – Matthew Dec 11 '18 at 15:28
  • 1
    Right, but this is Microsoft's hosted build agent in Azure. I don't have control over it but I expect MS to support latest and greatest. – bit0001 Dec 11 '18 at 17:54
  • What image are you using in your pipeline? – Matthew Dec 11 '18 at 18:09
  • Microsof't canned "Hosted VS2017". – bit0001 Dec 11 '18 at 18:35
  • 2.2 is not a LTS release, so it is latest but not the "greatest" https://dotnet.microsoft.com/platform/support-policy – Lex Li Dec 13 '18 at 21:59
  • @lexli how do you mean? this page: https://dotnet.microsoft.com/platform/support-policy/dotnet-core on the support table, 2.2.0 is clearly listed perhaps not at the time? – akousmata Jan 11 '19 at 17:42
  • @akousmata I meant what I typed. Not an LTS release has a series of consequences, especially on tooling side (for instance, a build machine might only contains LTS tooling, 2.1.402, but no other). – Lex Li Jan 11 '19 at 17:47
  • You can use this [link](https://github.com/Microsoft/azure-pipelines-image-generation/blob/master/images/win/Vs2017-Server2016-Readme.md) to see what is pre-installed on the build machines. – Matt Jan 15 '19 at 16:38

4 Answers4

15

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.

bit0001
  • 555
  • 1
  • 4
  • 12
  • 3
    The task is now called ".NET Core SDK Installer" . For anyone looking for a valid version for 2.1, I found that 2.1.500 works. Surprised that neither 2.1.0 nor 2.2.0 exists. – Brandon Culley Dec 12 '18 at 16:21
  • What a PITA... firstly the hosted agent should have 2.2 installed already, and secondly Microsoft really need to surface things like this in the UI somehow - I shouldn't have to resort to Google and SO :/ – Cocowalla Feb 07 '19 at 13:52
5

This does trick to my project:

steps:
- task: DotNetCoreInstaller@0
  displayName: 'Use .NET Core SDK Tool Installer'
  inputs:
    version: 2.2.100
- script: dotnet build --configuration $(buildConfiguration)
  displayName: 'dotnet build $(buildConfiguration)'
Y Kim
  • 119
  • 1
  • 13
4

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

1

The answer of @bit0001 is correct. Microsoft has a list of supported versions that can be installed using this task. You can find those versions here.

As you can see, 2.1.500 is supported when installing the sdk, 2.1.0 is not, you'll need to use 2.1.300. When installing only the runtime, you can use 2.1.0. Currently, the latest 2.2 version supported is 2.2.100.

Fokko
  • 188
  • 1
  • 14