C# Azure管道在dotnet构建中失败,需要升级到最新的.net核心版本

C# Azure管道在dotnet构建中失败,需要升级到最新的.net核心版本,c#,azure,asp.net-core,.net-core,azure-devops,C#,Azure,Asp.net Core,.net Core,Azure Devops,我在Azure管道中部署.Net核心API时遇到问题 构建失败,因为最近API从.Net Core 3.1升级到了.Net Core 5.0 如何升级已部署API中的版本 构建因此失败 2020-12-15T17:28:36.4659829Z Welcome to .NET Core 3.1! 2020-12-15T17:28:36.4663885Z --------------------- 2020-12-15T17:28:36.4664170Z SDK Version: 3.1.4

我在Azure管道中部署.Net核心API时遇到问题

构建失败,因为最近API从.Net Core 3.1升级到了.Net Core 5.0

如何升级已部署API中的版本

构建因此失败

    2020-12-15T17:28:36.4659829Z Welcome to .NET Core 3.1!
2020-12-15T17:28:36.4663885Z ---------------------
2020-12-15T17:28:36.4664170Z SDK Version: 3.1.404
2020-12-15T17:28:36.4664326Z 
2020-12-15T17:28:36.4664473Z Telemetry
2020-12-15T17:28:36.4664777Z ---------
2020-12-15T17:28:36.4665979Z The .NET Core tools collect usage data in order to help us improve your experience. It is collected by Microsoft and shared with the community. You can opt-out of telemetry by setting the DOTNET_CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell.
2020-12-15T17:28:36.4666549Z 
2020-12-15T17:28:36.4667054Z Read more about .NET Core CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry
2020-12-15T17:28:36.4667516Z 
2020-12-15T17:28:36.4667822Z ----------------
2020-12-15T17:28:36.4668277Z Explore documentation: https://aka.ms/dotnet-docs
2020-12-15T17:28:36.4668662Z Report issues and find source on GitHub: https://github.com/dotnet/core
2020-12-15T17:28:36.4669205Z Find out what's new: https://aka.ms/dotnet-whats-new
2020-12-15T17:28:36.4669786Z Learn about the installed HTTPS developer cert: https://aka.ms/aspnet-core-https
2020-12-15T17:28:36.4673694Z Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli-docs
2020-12-15T17:28:36.4678355Z Write your first app: https://aka.ms/first-net-core-app
2020-12-15T17:28:36.4678944Z --------------------------------------------------------------------------------------
2020-12-15T17:28:36.7880706Z Microsoft (R) Build Engine version 16.7.1+52cd83677 for .NET
2020-12-15T17:28:36.7881990Z Copyright (C) Microsoft Corporation. All rights reserved.
2020-12-15T17:28:36.7882687Z 
2020-12-15T17:28:37.4462789Z   Determining projects to restore...
2020-12-15T17:28:44.3820962Z   Restored /home/vsts/work/1/s/SynApi/SynApi.csproj (in 6.57 sec).
2020-12-15T17:28:45.1453408Z /home/vsts/work/1/s/Api/Api.csproj : warning NU1604: Project dependency Microsoft.AspNetCore.App does not contain an inclusive lower bound. Include a lower bound in the dependency version to ensure consistent restore results. [/home/vsts/work/1/s/Api.sln]

2020-12-15T17:28:45.5916387Z   Failed to restore /home/vsts/work/1/s/SynApi/SynApi.csproj (in 7.85 sec).
2020-12-15T17:28:45.6085564Z 
2020-12-15T17:28:45.6087169Z Build FAILED.

Azure还没有与.NET5一起提供。在管道的开头插入新步骤以安装.Net 5:

-任务:UseDotNet@2
显示名称:.Net 5
投入:
版本:5.0.100

或者,如果您使用的是经典图形界面,请添加步骤
Use.NetCore
,并确保使用正确的版本。到今天为止是5.0.100。

您能分享更多详细信息吗?你还没有告诉我们你的项目是什么样子,你的azure管道yaml是什么样子,或者其他什么。帮助我们帮助您,并请发布一个复制问题的最小自包含示例。您是否将应用程序升级到.NET 5?我在本地将应用程序升级到.NET 5,但当我升级到master时,构建没有反映出这一点。我刚刚用部署登录更新了这个问题,如果您使用的是声明性管道。这应该会有所帮助