Azure Functions运行报错U1100:无法为net6.0解析Microsoft.NET.Sdk.Functions
报错
U1100: Unable to resolve 'Microsoft.NET.Sdk.Functions (>= 4.0.1)' for 'net6.0'解决方案 - 检查NuGet源配置
运行终端命令dotnet nuget list source,确认存在官方源https://api.nuget.org/v3/index.json,如果不存在执行命令dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org添加即可。 - 清理缓存并重新还原包
终端依次执行以下命令:dotnet nuget locals all --clear dotnet clean dotnet restore - 调整包版本适配
把csproj文件中Microsoft.NET.Sdk.Functions的版本号从4.0.1升级到更高的兼容稳定版(例如4.2.0),该版本完全适配.NET 6和Azure Functions v4运行环境。 - 校验本地.NET SDK版本
运行命令dotnet --list-sdks,确认本地已安装.NET 6正式版SDK(版本号格式为6.0.x),若未安装则补装对应版本即可。 - 特殊场景处理
如果处于内网代理环境,将nuget.org域名加入代理白名单,避免代理拦截NuGet包请求。
内容的提问来源于stack exchange,提问作者Eric
相关产品推荐
相关产品推荐

