简体   繁体   English

NU1100:无法解析 'Microsoft.NET.Sdk.Functions (>= 3.0.3)' for '.NETCoreApp,Version=v3.1'

[英]NU1100:Unable to resolve 'Microsoft.NET.Sdk.Functions (>= 3.0.3)' for '.NETCoreApp,Version=v3.1'

When attempting to work with Azure functions, I get this error.尝试使用 Azure 函数时,出现此错误。 I am just trying to run the HttpExample I get the exact same error from the command as I do in Visual Studio Code.我只是想运行 HttpExample,我从命令中得到与在 Visual Studio Code 中完全相同的错误。 This is the code.这是代码。 I am a beginner at this so any help would be appricated.我是这方面的初学者,所以任何帮助都会得到应用。

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <AzureFunctionsVersion>v3</AzureFunctionsVersion>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.3" />
  </ItemGroup>
  <ItemGroup>
    <None Update="host.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <None Update="local.settings.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <CopyToPublishDirectory>Never</CopyToPublishDirectory>
    </None>
  </ItemGroup>
</Project>

Yes, I agree with Cindy's answer.是的,我同意 Cindy 的回答。 Having no entries or incorrect package source entries in packageSources xml node in Nuget.Config can cause the error.在 Nuget.Config 中的packageSources xml 节点中没有条目或不正确的 package 源条目可能会导致错误。

I have just encountered the same error when creating an Azure Function version 4.0.1 with .Net 6 released just a few days ago in Visual Studio Code.我在使用几天前在 Visual Studio Code 中发布的.Net 6创建Azure Function 版本 4.0.1时遇到了同样的错误。 I do not have Visual Studio 2022 installed.我没有安装 Visual Studio 2022。 I have .Net 6 SDK installed and use it with Visual Studio Code.我安装了.Net 6 SDK并将其与 Visual Studio Code 一起使用。 You would think that the NuGet utility installed with.Net 6 SDK should have configured <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" /> in your user level or global level NuGet settings by default.你会认为安装.Net 6 SDK 的NuGet实用程序应该配置了<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />在您的用户级别全局级别默认设置为 NuGet But it did not.但事实并非如此。

I run do.net nuget add source https://api.nuget.org/v3/index.json -n nuget.org command in a DOS Command Prompt or a PowerShell session to add the nuget.org as a packageSource in my user level setting nuget.config file. I run do.net nuget add source https://api.nuget.org/v3/index.json -n nuget.org command in a DOS Command Prompt or a PowerShell session to add the nuget.org as a packageSource in my user级别设置 nuget.config 文件。 That solved the **NU1100 Unable to resolve ** error.这解决了 **NU1100 无法解决 ** 错误。

On another note, I would say Visual Studio 2022 or its previous versions will configure nuget.org as the default package source for NuGet because I did not have to do that manually when I used Visual Studio 2017 before to download or restore NuGet packages.另一方面,我会说 Visual Studio 2022 或其以前的版本会将 nuget.org 配置为 NuGet 的默认 package 源,因为在我之前使用 Visual Studio 2017 下载或恢复 NuGet 包时,我不必手动执行此操作。

The format of your.csproj file is actually no problem.你的.csproj文件的格式其实是没有问题的。 Your code of.csproj works fine on my side.您的代码 of.csproj 在我这边工作正常。

By the way, version 3.0.3 of Microsoft.NET.Sdk.Functions is compatible with.Net Core 3.1.顺便说一句,Microsoft.NET.Sdk.Functions 3.0.3版本兼容.Net Core 3.1。 I think the problem is with your package management tool.我认为问题出在您的 package 管理工具上。 If you use nuget, please check its configuration.如果您使用nuget,请检查其配置。

This is my Nuget.Config:这是我的 Nuget.Config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
  </packageSources>
</configuration>

Or you can try to reinstall your nuget management tool.或者您可以尝试重新安装您的 nuget 管理工具。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法为“.NETCoreApp,Version=v3.1”解析“Microsoft.EntityFrameworkCore (&gt;= 3.1.7)” - Unable to resolve 'Microsoft.EntityFrameworkCore (>= 3.1.7)' for '.NETCoreApp,Version=v3.1 错误 NU1100:无法解析 &#39;Microsoft.AspNetCore.SpaServices.Extensions - error NU1100: Unable to resolve 'Microsoft.AspNetCore.SpaServices.Extensions 错误 NU1100:无法为“net6.0”解析“HtmlAgilityPack (&gt;= 1.11.45)”和“System.Drawing.Common (&gt;= 6.0.0)” - error NU1100: Unable to resolve 'HtmlAgilityPack (>= 1.11.45)' and 'System.Drawing.Common (>= 6.0.0)' for 'net6.0' Visual Studio .NETCoreapp v3.1 &amp; iTextSharp - Visual Studio .NETCoreapp v3.1 & iTextSharp 错误 NU1202: Package Microsoft.AspNetCore.Blazor.Cli 0.7.0 与 netcoreapp2.0 (.NETCoreApp,Version=v2.0) 不兼容 - error NU1202: Package Microsoft.AspNetCore.Blazor.Cli 0.7.0 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0) 无法转换为 json 响应驼峰案例 newtonsoft.json 和 Microsoft.NET.Sdk.Functions 1.0.24 - can not convert to json response to camel case newtonsoft.json and Microsoft.NET.Sdk.Functions 1.0.24 尝试从私有NuGet存储库中提取NuGet软件包时出现NU1100错误 - NU1100 Error When Attempting to Pull NuGet Package From Private NuGet Repo 迁移到 .Net Core v3.1 后 IAsyncQueryProvider 构建错误 - IAsyncQueryProvider build errors after migrating to .Net Core v3.1 dotnet restore fail“无法为'.NETCoreApp解决'PCLLibrary',版本= v1.0'。” - dotnet restore fail “Unable to resolve 'PCLLibrary' for '.NETCoreApp,Version=v1.0'.” Microsoft反跨站点脚本库v3.1下载 - Microsoft anti-cross site scripting library v3.1 download
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM