4

I just updated a solution to use net50, and it builds locally, but does not build in an Azure pipeline. How do I specify an Azure pipeline agent capable of building net50 projects?


The pipeline fails on the nuget restore step with the following error:

The nuget command failed with exit code(1) and error([***].csproj : error : 
Version 5.0.100 of the .NET Core SDK requires at least version 16.8.0 of MSBuild. 
The current available version of MSBuild is 16.7.0.37604. 
Change the .NET Core SDK specified in global.json to an older version that requires the MSBuild version currently available.

My pipeline yaml includes:

trigger:
- master

pool:
  vmImage: 'windows-latest'

variables:
  buildConfiguration: 'Debug'

steps:

- task: UseDotNet@2
  displayName: 'Use .NET Core sdk'
  inputs:
    packageType: sdk
    version: 5.x
    installationPath: $(Agent.ToolsDirectory)/dotnet

- task: NuGetCommand@2
  displayName: 'nuget restore'
  inputs:
    restoreSolution: '**/*.sln'
    feedsToUse: config
    nugetConfigPath: 'NuGet.config'

2 Answers 2

5

A workaround to using the NuGetCommand@2 step is to use the DotNetCoreCLI@2 step instead. This may not be viable if you are building legacy (non-SDK) projects.

My YAML is now:

trigger:
- master

pool:
  vmImage: 'windows-latest'

variables:
  buildConfiguration: 'Debug'

steps:

- task: UseDotNet@2
  displayName: 'Use .NET Core sdk'
  inputs:
    packageType: sdk
    version: 5.x
    installationPath: $(Agent.ToolsDirectory)/dotnet

- task: DotNetCoreCLI@2
  displayName: 'dotnet restore'
  inputs:
    command: 'restore'
    projects: '**/*.csproj'
    feedsToUse: 'config'
    nugetConfigPath: 'nuget.config'

Thanks to @Krzysztof for pointing me in the right direction.

FWIW, and this is from memory, using DotNetCoreCLI@2 for a net48 project - which happened to be included in this pipeline's solution - failed under netcoreapp3.1, but appears to work under net50.

Sign up to request clarification or add additional context in comments.

Comments

2

It looks that images haven't been updated yet and 16.8 is not available. Please check this GitHub issue:

We keep the visual studio version always up to date. However, deploying images can sometimes take a week(or two).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.