简体   繁体   中英

Nuget Restore fails on Azure DevOps Pipeline

My .net core 3.0 API Project fails to build on the Azure Devops Pipeline because the Restore Package Task fails with this error :

NU1605: Detected package downgrade: Microsoft.AspNetCore.Razor.Design from 2.2.0 to 2.1.2. Reference the package directly from the project to select a different version. WebApi -> Microsoft.AspNetCore.App 2.2.0 -> Microsoft.AspNetCore.Razor.Design (>= 2.2.0 && < 2.3.0) WebApi -> Microsoft.AspNetCore.Razor.Design (>= 2.1.2))

I just can't figure out what to do. This Razor.Design package is not even referenced in my project but I guess AspNetCore.App depends on it (then why does it work locally without this package is a mistery to me).

I'm running the Pipeline on Agent with Windows 2019 image. dotnetcore30 should not be a problem.

For this issue, without your project file, I'm not sure about your project structure and relationship of package dependencies.

But as the error message Reference the package directly from the project to select a different version indicates, normally in this situation we can try directly reference the specific package with specific version to work around it.

<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="all" />

Also, here's an official document which describes some examples and corresponding solutions for this kind of issue, you can check that for trouble-shooting.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM