4

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
Sharp Always
  • 61
  • 2
  • 6
  • 2
    The 'already has a dependency defined for' error message suggests your NuGet package version is too old and does not support some of the target frameworks defined, probably .NET Standard, on the group dependencies in the .nuspec file in the NuGet package. This question is pretty much the same as this one - https://stackoverflow.com/questions/38247961/nuget-package-manager-automapper-already-has-a-dependency-defined-for-micros - The only workaround is to upgrade Visual Studio to a more recent version or use a very old version of the HtmlAgilityPack such as version 1.3.0 – Matt Ward Sep 06 '17 at 08:46
  • First try going to Project->Manage NuGet Packages. Go under the "Updates"-tab and update your package. Current version is 1.6.5 – Kent Kostelac Nov 16 '17 at 00:38
  • Possible duplicate of [NuGet Package Manager: 'AutoMapper' already has a dependency defined for 'Microsoft.CSharp'](https://stackoverflow.com/questions/38247961/nuget-package-manager-automapper-already-has-a-dependency-defined-for-micros) – T.J. Crowder Dec 12 '17 at 11:28

3 Answers3

8

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

Naucle
  • 626
  • 12
  • 28
0

nuget deleted this verson of HtmlAgilityPack ;

you can Download from this link https://www.dll-files.com/htmlagilitypack.dll.html

but this canot support GetElementsByTagName :\

0

Download the latest version and refer the dll from packages. It works. No dependency issues.