Error with adding reference of HtmlAgilityPack to class

3

I am getting an error while adding this to my class, does somebody know the solution for this? Using 4.5 framework.

Could not load file or assembly 'HtmlAgilityPack, Version=1.4.9.0, Culture=neutral,   PublicKeyToken=bd319b19eaf3b43a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

I have this in my packages.config

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="HtmlAgilityPack" version="1.4.9.0" targetFramework="net45" />
</packages>

packages gives a error that its not declared

I have tried to add it to debug, include it local but nothing seems to make it work

Update:

still same error adjusted it like this, but not sure if correct:

<configuration>
<packages>
    <package id="HtmlAgilityPack" version="1.4.9.0" targetFramework="net45" />
</packages>
<dependentAssembly>
    <assemblyIdentity name="HtmlAgilityPack" publicKeyToken="bd319b19eaf3b43a" culture="neutral" />
    <bindingRedirect oldVersion="1.4.5.0-1.4.7.0" newVersion="1.4.9.0" />
</dependentAssembly>
</configuration>
c#
html-agility-pack
asked on Stack Overflow Nov 3, 2014 by user3763117 • edited Nov 3, 2014 by user3763117

1 Answer

0

I fixed it by adding the same assemblyIdentity and bindingRedirect to the web.config (or app.config). Make sure it's in the corresponding place: inside configuration - runtime - assemblyBinding.

  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="HtmlAgilityPack" publicKeyToken="bd319b19eaf3b43a" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-1.11.23.0" newVersion="1.11.23.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

Hope it helps.

answered on Stack Overflow Apr 23, 2020 by Ymagine First

User contributions licensed under CC BY-SA 3.0