[英]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 :我的 .net core 3.0 API 项目无法在 Azure Devops 管道上构建,因为还原包任务失败并出现以下错误:
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).这个 Razor.Design 包在我的项目中甚至没有被引用,但我猜 AspNetCore.App 依赖于它(那么为什么它在没有这个包的情况下在本地工作对我来说是个谜)。
I'm running the Pipeline on Agent with Windows 2019 image.我正在使用 Windows 2019 映像在代理上运行管道。 dotnetcore30 should not be a problem. dotnetcore30 应该没有问题。
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.但是正如错误消息Reference the package directly from the project to select a different version
指示的那样,通常在这种情况下我们可以尝试直接引用具有特定版本的特定包来解决它。
<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.另外,这里有一份官方文档,介绍了此类问题的一些示例和相应的解决方案,您可以查看以进行故障排除。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.