Cant install HtmlAgilityPack on VS2012

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

Question

I can not install the HtmlAgilityPack by nuget ... I already uninstalled and reinserted the nuget, I changed the .NET version and still the same error

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

Popular Answer

This is because, to my understanding, the latest version of 'System.Net.Http' is not compatible with the latest version of Nuget that you can get on VS2012 (which is Nuget 2.8, same applies to VS2010). So, you have two options here :

  • Option 1

Install the latest version of Visual Studio where you'll get the latest version of Nuget and you won't have this problem anymore.

  • Option 2

Instead of picking the lastest version of the package 'HtmlAgilityPack', just get the last version that works with VS2012/2010, which is 1.4.9.5. Which means that you'll be using :

PM> Install-Package HtmlAgilityPack -Version 1.4.9.5




Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why