Azure Devops Pipeline 在 .NET 5 版本、MSBuild 版本等上崩溃。知道如何解决这个问题吗?

Azure Devops Pipeline crashes on .NET 5 version, MSBuild version etc. Any idea how to fix this?

所以我在 .NET 5 中做了一个后端项目。 我现在正在尝试在我的代码所在的 Azure Devops 中创建一个发布管道。

错误包括:

Error : Version 5.0.100 of the .NET Core SDK requires at least version 16.8.0 of MSBuild. The current available version of MSBuild is 15.9.21.664. Change the .NET Core SDK specified in global.json to an older version that requires the MSBuild version currently available.

Error MSB4236: The SDK 'Microsoft.NET.Sdk.Web' specified could not be found.  

C:\Program Files (x86)\Microsoft Visual Studio17\Enterprise\MSBuild.0\Bin\Microsoft.Common.CurrentVersion.targets(1179,5): Error MSB3644: The reference assemblies for framework ".NETFramework,Version=v5.0" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend.  

上图中我采取的步骤:

首先我使用了几乎最新版本的Nuget,5.8.0
然后下一个工作是“nuget restore”。
下一步是专门指定它需要使用 .NET 5 SDK(如果不包括此作业,Azure Devops 会对此抛出错误,指出它找不到 runtime=net50 等...)。
这是更详细的屏幕:

下一项工作是“MSBuild”,这里有更多详细信息:

这个“MSBuild”作业取代了我的“Visual StudioBuild”作业,因为在这里我可以将它设置为“16.0”版本,但显然这不起作用?常规的“Visual Studio 构建”细节看起来完全一样,即使在我的设置中也是如此,但不包括“MSBuild 版本”选项。使用常规的“Visual Studio 构建”选项不起作用(也请参见上述错误)。

下一份工作他甚至还没有完成,所以我现在假设他们工作正常。问题确实与构建、使用 SDK、还原等有关...

有没有在 .NET Framework 5.0 或更高版本中制作 azure pipelines/builds 有更多经验的人知道这里出了什么问题以及我该如何解决这个问题?或者甚至是我应该看哪里的想法?

我一整天都在为此伤脑筋,它快要爆炸了...

您应该对 restore/build 等 .net 核心应用程序使用不同类型的任务

https://docs.microsoft.com/en-us/azure/devops/pipelines/ecosystems/dotnet-core?view=azure-devops&tabs=dotnetfive