简体   繁体   English

Azure DevOps Pipeline 上的 Nuget 还原失败

[英]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.

相关问题 Nuget 恢复在 Azure Devops 中无法使用工件提要 - Nuget restore not working with artifact feed in Azure Devops 由于 Nuget 工件源上的 URL 格式错误,Azure DevOps dotnet 还原任务失败 - Azure DevOps dotnet restore task fails due to wrong URL format on Nuget artifact feed Nuget 在 Azure Devops 上恢复失败,并显示消息“无法加载源的服务索引” - Nuget restore fails on Azure Devops with message "unable to load the service index for source" Azure DevOps 管道在恢复时失败 - 测试项目与 netcoreapp2.2 不兼容项目支持:netcoreapp3.0 - Azure DevOps pipeline fails at Restore - Test project is not compatible with netcoreapp2.2 Project supports: netcoreapp3.0 从构建或发布管道在 azure devops 中发布 nuget 包 - Publish nuget package in azure devops from build or release pipeline Azure 构建管道 NuGet 还原错误 NETSDK1045 - Azure build pipeline NuGet Restore error NETSDK1045 在 Azure DevOps Build Pipeline 中恢复 Libman JS 库 - Restore Libman JS Libraries in Azure DevOps Build Pipeline 奇怪的行为从 azure devops 管道中的本地提要恢复 package - Strange behavior restore package from local feed in azure devops pipeline Nuget 还原失败并进行身份验证 - Nuget restore fails with authentication .Net Core解决方案在本地构建,但无法在Azure DevOPS管道上构建 - .Net Core solutions build locally, but fails build on Azure DevOPS pipeline
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM