azure - .Net 5 Azure Pipeline - 找不到指定的 SDK 'Microsoft.NET.Sdk.BlazorWebAssembly'
问题描述
我将我们的项目升级到 .NET 5 并在构建时收到此错误 azure pipeline 错误:
The nuget command failed with exit code(1) and error(C:\agent\_work\91\s\src\Main.Blazor\Main.Blazor.csproj : error : C:\Program Files\dotnet\sdk\3.1.401\Sdks\Microsoft.NET.Sdk.BlazorWebAssembly\Sdk not found. Check that a recent enough .NET Core SDK is installed and/or increase the version specified in global.json.
Microsoft.NET.Sdk.BlazorWebAssembly
找不到指定的 SDK
这是它失败的任务,并且.NET 5 已经安装在这台机器上,我可能缺少什么吗?
- task: NuGetCommand@2
displayName: 'NuGet Restore'
inputs:
command: 'restore'
restoreSolution: '$(solution)'
feedsToUse: 'select'
vstsFeed: '842a57e5-e138-4563-9d88-36c4b1476f72'
解决方案
正如您在错误消息中看到的,似乎正在使用 .NET Core 3.1.401 sdk。
在实际运行任何 dotnet/nuget 命令之前尝试添加以下步骤:
- task: UseDotNet@2
displayName: 'Use .NET 5.0.x'
inputs:
packageType: sdk
version: '5.0.x'
推荐阅读
- c++ - 如何将 websocket 客户端连接到服务器?
- c# - 单元测试中的堆栈溢出错误(Resharper、C#、NUnit)。测试中止
- python - 将菜单从另一个模块导入到 tkinter 中的主模块
- android - Firebase FCM - 通过 ADMIN SDK 在 android 上显示通知时间戳
- java - 如何启动 Java API(后端)
- css - 如何导入 SVG 以与 JS/CSS 完全交互?
- python - 用于 XML 到 DataFrame 转换功能的 RAM 崩溃
- python - 在绘制价格与时间的数据时动态减少 matplotlib 中的 xticks 数量
- python - 为什么 matplotlib circle/patchCollection 的旋转点会改变
- c++ - 在头文件中放置结构时出错