使用 Azure DevOps 和 Blazor Server App 构建错误

Build errors with Azure DevOps and Blazor Server App

我正在尝试将标准的“开箱即用”Blazor 服务器应用程序添加到 Azure DevOps CI/CD 管道。

每次我尝试构建管道时都会抛出此错误(简而言之)

错误 MSB3644:找不到框架“.NETFramework,Version=v5.0”的参考程序集。

完整版:

##[error]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.

所以我显然缺少对框架的引用,但我该如何添加它?人们会假设标准的 Blazor 服务器应用程序已准备好完成这项工作..

创建管道时,我遵循了以下步骤:

第 1 步 - 入门模板

步骤 2 - 添加 .NET Core sdk 和 dotnet 构建

第 3 步 - 生成错误...

关于如何解决此错误的任何想法?

Build errors with Azure DevOps and Blazor Server App

请尝试使用托管代理 windows-2019 而不是 vs2017-win2016 来构建此解决方案。

那是因为 .NET 5 RC1 的最低版本是 VS 16.8 Preview 3.

引用 link: .NET 5.0.