.NET Core 3.1下Azure Functions依赖解析NU1100错误求助
Azure Functions项目NU1100依赖解析错误求助
我正在开发一个包含访问计数功能的Azure Functions网站项目,跟着视频教程推进到对应步骤时,遇到了以下NU1100依赖解析错误:
error NU1100: Unable to resolve 'Microsoft.NET.Sdk.Functions (>= 3.1.1)' for '.NETCoreApp,Version=v3.1' error NU1100: Unable to resolve 'Microsoft.NETCore.App.Ref (= 3.1.0)' for '.NETCoreApp,Version=v3.1' error NU1100: Unable to resolve 'Microsoft.WindowsDesktop.App.Ref (= 3.1.0)' for '.NETCoreApp,Version=v3.1' error NU1100: Unable to resolve 'Microsoft.AspNetCore.App.Ref (= 3.1.10)' for '.NETCoreApp,Version=v3.1'
我的开发环境是VS Code和Git Bash,已经尝试过以下方法但问题仍未解决:
- 手动解析依赖项
- 下载安装.NET 6.0 SDK及运行时(最初用.NET 6创建项目,后来因为教程使用3.0 LTS版本,改为了3.1)
- 下载安装NuGet
我对C#和Azure Functions开发经验不足,附上相关代码恳请帮助:
using System; using System.IO; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.Azure.WebJobs; using Microsoft.Azure.WebJobs.Extensions.Http; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Logging; using Newtonsoft.Json; namespace Company.Function { public static class GetResumeCounter { [FunctionName("GetResumeCounter")] public static async Task<IActionResult> Run( [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req, ILogger log) { log.LogInformation("C# HTTP trigger function processed a request."); string name = req.Query["name"]; string requestBody = await new StreamReader(req.Body).ReadToEndAsync(); dynamic data = JsonConvert.DeserializeObject(requestBody); name = name ?? data?.name; string responseMessage = string.IsNullOrEmpty(name) ? "This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response." : $"Hello, {name}. This HTTP triggered function executed successfully."; return new OkObjectResult(responseMessage); } } }

内容的提问来源于stack exchange,提问作者stackacct16
相关产品推荐
相关产品推荐

