简体   繁体   English

错误 NU1100:无法为“net6.0”解析“HtmlAgilityPack (>= 1.11.45)”和“System.Drawing.Common (>= 6.0.0)”

[英]error NU1100: Unable to resolve 'HtmlAgilityPack (>= 1.11.45)' and 'System.Drawing.Common (>= 6.0.0)' for 'net6.0'

Here's my csproj targeting net6.0 :这是我的csproj针对net6.0

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net6.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="HtmlAgilityPack" Version="1.11.45" />
    <PackageReference Include="System.Drawing.Common" Version="6.0.0" />
  </ItemGroup>
</Project>

It needs two libraries HtmlAgilityPack and System.Drawing.Common .它需要两个库HtmlAgilityPackSystem.Drawing.Common Both are.Net6.0 compatible (according to nuget).两者都兼容.Net6.0(根据nuget)。 Locally I have .NET SDK installed for net6.0:在本地,我为 net6.0 安装了 .NET SDK:

dotnet --info
.NET SDK (reflecting any global.json):
 Version:   6.0.400
 Commit:    7771abd614

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19043
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\6.0.400\

global.json file:
  Not found

Host:
  Version:      6.0.8
  Architecture: x64
  Commit:       55fb7ef977

.NET SDKs installed:
  6.0.400 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Yet, when I run dotnet restore I get this error:然而,当我运行dotnet restore时,我收到此错误:

  Determining projects to restore...
C:\Repos\test\test.csproj : error NU1100: Unable to resolve 'HtmlAgilityPack (>= 1.11.45)' for 'net6.0'.
C:\Repos\test\test.csproj : error NU1100: Unable to resolve 'System.Drawing.Common (>= 6.0.0)' for 'net6.0'.
  Failed to restore C:\Repos\test\test.csproj (in 104 ms).

What am I missing here?我在这里想念什么? I think dotnet restore should complete without errors.我认为dotnet restore应该没有错误地完成。

Per @PMF's suggestion.根据@PMF 的建议。

  1. Ran dotnet restore -v detailed , got the same error.dotnet restore -v detailed ,得到同样的错误。
  2. From the output found global nuget.config file ( C:\Users\admin\AppData\Roaming\NuGet\NuGet.Config ).从 output 找到全局nuget.config文件( C:\Users\admin\AppData\Roaming\NuGet\NuGet.Config
  3. Checked the config:检查了配置:
<?xml version="1.0"?>
<configuration>
  <packageSources>
  </packageSources>
</configuration>
  1. Added nuget : 添加了 nuget
<?xml version="1.0"?>
<configuration>
  <packageSources>
    <add key="NuGet" value="https://api.nuget.org/v3/index.json" />
  </packageSources>
</configuration>

After that dotnet restore worked as expected.之后dotnet restore按预期工作。

暂无
暂无

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

相关问题 错误 NU1100:无法解析 &#39;Microsoft.AspNetCore.SpaServices.Extensions - error NU1100: Unable to resolve 'Microsoft.AspNetCore.SpaServices.Extensions 尝试从私有NuGet存储库中提取NuGet软件包时出现NU1100错误 - NU1100 Error When Attempting to Pull NuGet Package From Private NuGet Repo 错误 NU1100: Microsoft.NET.Sdk.Functions (&gt;= 3.1.1)' for '.NETCoreApp,Version=v3.1 (new to c#, ZCF04A02E37B774FC391Z4A) - error NU1100: Microsoft.NET.Sdk.Functions (>= 3.1.1)' for '.NETCoreApp,Version=v3.1 (new to c#, azure functions, coding in general) 为什么无法删除System.Drawing并替换为NuGet包System.Drawing.Common - Why unable to remove System.Drawing and replace with NuGet package System.Drawing.Common 无法将 MVC 框架升级到 .net6.0 - Unable to upgrade MVC framework to .net6.0 在 AWS Lambda 上使用 System.Drawing.Common NuGet 包时无法加载 DLL“libdl” - Unable to load DLL 'libdl' when using System.Drawing.Common NuGet package on AWS Lambda .NET Core System.Drawing.Common PrintDocument在Linux上不起作用 - .NET Core System.Drawing.Common PrintDocument doesn't work on Linux .NET System.Drawing.Common 4.5.1 的 NuGet 包包含不正确的程序集版本 - NuGet package for .NET System.Drawing.Common 4.5.1 contains incorrect version of assemblies .NET 6/7 从 System.Drawing.Common 迁移到 Microsoft.Maui.Graphics - .NET 6/7 Migration from System.Drawing.Common to Microsoft.Maui.Graphics 使用命名空间“System.Drawing”时出错。 要求我使用“System.Drawing.Common”。 如何在 azure 函数中执行此操作 - Getting error when using namespace 'System.Drawing'. asking me to use 'System.Drawing.Common' . how to do this in azure functions
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM