c# - 无法在 VS2012 上安装 HtmlAgilityPack

标签 c# visual-studio-2012 nuget html-agility-pack

我无法通过 nuget 安装 HtmlAgilityPack ... 我已经卸载并重新插入了 nuget,我更改了 .NET 版本,但仍然出现相同的错误

Install-Package : 'HtmlAgilityPack' already has a dependency defined for 'System.Net.Http'.
At line:1 char:16
+ Install-Package <<<<  HtmlAgilityPack -Version 1.5.1
    + CategoryInfo          : NotSpecified: (:) [Install-Package], InvalidOperationException
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPa 
   ckageCommand

最佳答案

这是因为,据我了解,最新版本的“System.Net.Http”与您可以在 VS2012 上获得的最新版本的 Nuget 不兼容(Nuget 2.8,同样适用于 VS2010)。所以,您在这里有两个选择:

  • 选项 1

安装最新版本的 Visual Studio,您将获得最新版本的 Nuget,您将不会再遇到此问题。

  • 选项 2

与其选择包“HtmlAgilityPack”的最新版本,不如获取适用于 VS2012/2010 的最新版本,即 1.4.9.5。这意味着您将使用:

PM> Install-Package HtmlAgilityPack -Version 1.4.9.5

关于c# - 无法在 VS2012 上安装 HtmlAgilityPack,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46061487/

相关文章:

nuget - 在企业内管理 Nuget 包的行业标准

c# - 使用 AES 解密少量字节

c# - webrole 上的 Azure WCF 服务上基于 x509 证书的身份验证

C# Visual Studio 以另一种方式打开上下文菜单?

visual-studio - Visual Studio 2012行号/大纲装订线丢失

deployment - 没有互联网的 Dotnet 运行/恢复(离线模式)

silverlight - MVVM Light Nuget包中缺少SimpleIoc

c# - Oxyplot 中断 DateTimeAxis 系列

c# - FileHelpers .NET 库的最新生产就绪版本是什么?它在哪里?

c# - 如何将 public void PassValue(string) 中的文本调用到 private void Form1_Load()