簡體   English   中英

Azure DevOps Pipeline 在 NuGet 恢復任務中失敗

[英]Azure DevOps Pipeline failing at NuGet restore task

I created a Azure function Project in Visual studio 2019. Everything works great on my desktop but the project is failing at NuGet Restore task in Azure DevOps Pipeline with below error.

Package Microsoft.Azure.WebJobs 3.0.0 與 netcoreapp3.1 不兼容

2020-06-09T08:32:02.2578449Z ##[error]The nuget command failed with exit code(1) and error(Errors in E:\agent_work\491\s\CPUSRETools\AzureCapacityUsage\AzureCapacityUsage.csproj Package Microsoft.Azure .WebJobs 3.0.0 is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1). Package Microsoft.Azure.WebJobs 3.0.0 supports: netstandard2.0 (.NETStandard,Version=v2.0) Package Microsoft. Azure.WebJobs.Extensions 3.0.0 is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1). Package Microsoft.Azure.WebJobs.Extensions 3.0.0 supports: netstandard2.0 (.NETStandard,Version=v2. 0) Package Microsoft.Azure.WebJobs.Extensions.Http 3.0.0 與 w 不兼容 ith netcoreapp3.1(.NETCoreApp,版本=v3.1)。 Package Microsoft.Azure.WebJobs.Extensions.Http 3.0.0 supports: netstandard2.0 (.NETStandard,Version=v2.0) One or more packages are incompatible with .NETCoreApp,Version=v3.1.)

2020-06-09T08:32:02.2592475Z ##[debug]Processed:##vso[task.issue type=error;]nuget 命令失敗,退出代碼 (1) 和錯誤(E:\agent_work\491 中的錯誤\s\CPUSRETools\AzureCapacityUsage\AzureCapacityUsage.csproj%0D%0A Package Microsoft.Azure.WebJobs 3.0.0 is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1). Package Microsoft.Azure.WebJobs 3.0.0 supports: netstandard2.0 (.NETStandard,Version=v2.0)%0D%0A Package Microsoft.Azure.WebJobs.Extensions 3.0.0 is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1). Package Microsoft .Azure.WebJobs.Extensions 3.0.0 supports: netstandard2.0 (.NETStandard,Version=v2.0)%0D%0A Package Microsoft.Azure.WebJobs.Extensions.Z9 D4D43DE68F0B3555D5A5EF5DC05BB95Z 3.0.0 與 netcoreapp3.1 (.NETCoreApp,Version=v3.1) 不兼容。 Package Microsoft.Azure.WebJobs.Extensions.Http 3.0.0 supports: netstandard2.0 (.NETStandard,Version=v2.0)%0D%0A One or more packages are incompatible with .NETCoreApp,Version=v3.1.)

2020-06-09T08:32:02.2594955Z ##[debug]任務結果:失敗

2020-06-09T08:32:02.2595537Z ##[錯誤]包無法恢復

從錯誤中可以看出,dotnet 任務使用的是 2.1.806 版本的 dotnet sdk。 但是您的項目的目標是 dotnet 3.1。

您可以使用任務Use.Net Core在管道中使用特定版本的.Net Core(版本 3.1)。 見下文

- task: UseDotNet@2
  displayName: 'Use .NET Core sdk'
  inputs:
    packageType: sdk
    version: 3.x

- task: DotNetCoreCLI@2
    inputs:
      command: restore
      projects: '**\*.csproj'

我設法找到解決我的問題的方法。 我有 9 個項目,我使用 VSBuild Task 構建得很好。 一個項目未能在 VSBuild 任務中構建。 因此,我將該任務移至新的解決方案。 將 VSBuild 指向具有 9 個項目的舊解決方案,並將 .NET 構建任務指向在 VSBuild 中失敗的新解決方案文件。

現在世界又是多彩的。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM