You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

dotnet restore遇NU1100错误:无法解析net6.0依赖包

问题:dotnet restore无法解析net6.0兼容的NuGet包

我的项目目标框架为net6.0,对应的csproj内容如下:

<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>

项目依赖HtmlAgilityPack和System.Drawing.Common两个库,根据NuGet官网显示二者均兼容net6.0。本地已安装net6.0版本的.NET SDK,执行dotnet --info输出如下:

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]

但执行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).

请问我遗漏了什么?为何dotnet restore无法正常完成?


内容的提问来源于stack exchange,提问作者rfg

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.19 21:01:06