[英]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 .它需要两个库HtmlAgilityPack和System.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 的建议。
dotnet restore -v detailed
, got the same error.跑dotnet restore -v detailed
,得到同样的错误。nuget.config
file ( C:\Users\admin\AppData\Roaming\NuGet\NuGet.Config
).从 output 找到全局nuget.config
文件( C:\Users\admin\AppData\Roaming\NuGet\NuGet.Config
。<?xml version="1.0"?>
<configuration>
<packageSources>
</packageSources>
</configuration>
<?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.