D. Zaraki
D. Zaraki

Reputation: 35

My azure pipeline fails with my NugetCommand on several packages in Azure Devops

as seen in the title my azure pipeline fails with the following log

##[error]The nuget command failed with exit code(1) and error(NU1202: Package MediatR.Extensions.Microsoft.DependencyInjection 10.0.1 is not compatible with net50 (.NETFramework,Version=v5.0). Package MediatR.Extensions.Microsoft.DependencyInjection 10.0.1 supports: netstandard2.1 (.NETStandard,Version=v2.1)

I can post more but the messages are the same for other packages such as Automapper and EntityFrameworkCore.

I'm using the following steps in my YAML file.

steps:

  • task: NuGetToolInstaller@0 displayName: 'Use NuGet 5.1.0' inputs: versionSpec: 5.1.0

  • task: UseDotNet@2 displayName: 'Use .NET Core sdk 5.0.x' inputs: version: 5.0.x includePreviewVersions: true

  • task: NuGetCommand@2 inputs: restoreSolution: '$(solution)'

am I missing something?

Upvotes: 1

Views: 1782

Answers (1)

Leo Liu
Leo Liu

Reputation: 76910

My azure pipeline fails with my NugetCommand on several packages in Azure Devops

To resolve this issue, please try to use the latest nuget version:

- task: NuGetToolInstaller@1
  displayName: 'Use NuGet '
  inputs:
    checkLatest: true

If still have this issue, try to disable nuget restore task and add the 'dotnet restore' task.

Upvotes: 2

Related Questions