could not load file or assembly HtmAgilityPack verion 1.4.6.0

12,838

Solution 1

ok, i did alot of searching and thanks to @Caleb and other person for being with me through it all. i uninstalled and reinstalled the different version of CR. It brought up some COM error about some object model lib. I removed the reference and tada.. it's working fine now. And DO NOT forget to do this:

`When using ADO.NET with the Microsoft .NET Framework 4.0 (and above), the following setting must be added to the application’s configuration file:

<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"/>
</startup>
</configuration>`

Hope this helps.

Solution 2

I guess the error is with the version of assembly.

You specify that you work with follow :

HtmlAglilityPack: 1.4.9.0

In your code you have following

 <assemblyIdentity name="HtmlAgilityPack" publicKeyToken="bd319b19eaf3b43a" culture="neutral" />  
 <bindingRedirect oldVersion="1.4.5.0-1.4.6.0" newVersion="1.4.6.0" /> 

I believe it shouldn't be there since you are using the newer version 1.4.9.0 and you already have that reference. (Which I miss to note on my first try to answer)

  <dependentAssembly>
  <assemblyIdentity name="HtmlAgilityPack" publicKeyToken="bd319b19eaf3b43a" culture="neutral" />
  <bindingRedirect oldVersion="0.0.0.0-1.4.9.0" newVersion="1.4.9.0" />
  </dependentAssembly>
Share:
12,838
Sana Qureshi
Author by

Sana Qureshi

Updated on August 02, 2022

Comments

  • Sana Qureshi
    Sana Qureshi over 1 year

    Ok, i have tried EVERYTHING mentioned on the internet. I have made most of my project in VS 2013 Express for Web. Since it doesn't support Crystal Reports, i reverted to VS2012 Ultimate. It opened the solution just fine and is working as well. The trouble i am having is when i try to add report, it goes past the Naming part, when it is about to load the report page it gives me the following error: ErrorLink. My Toolkit was working fine on VS2013. Toolkit version: 7.1213 AjaxMin: 4.97 HtmlAglilityPack: 1.4.9

    I am giving my web.config file here:

        <?xml version="1.0" encoding="utf-8"?>
    <!--
      For more information on how to configure your ASP.NET application, please visit
      http://go.microsoft.com/fwlink/?LinkId=169433
      -->
    
    <configuration>
      <configSections>
        <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
        <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    
      </configSections>
      <connectionStrings>
        <add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;AttachDbFilename=|DataDirectory|\aspnet-SMC-20141224085758.mdf;Initial Catalog=aspnet-SMC-20141224085758;Integrated Security=True" providerName="System.Data.SqlClient" />
        <add name="masterConnectionString" connectionString="Data Source=sana\sqlexpress;Initial Catalog=master;Integrated Security=True" providerName="System.Data.SqlClient" />
        <add name="SMCConnectionString" connectionString="Data Source=sana\sqlexpress;Initial Catalog=SMC;Integrated Security=True" providerName="System.Data.SqlClient" />
      </connectionStrings>
      <appSettings>
        <add key="ValidationSettings:UnobtrusiveValidationMode" value="None"></add>
      </appSettings>
      <system.web>
        <authentication mode="None" />
        <compilation debug="true" targetFramework="4.5" />
        <httpRuntime targetFramework="4.5" />
        <pages>
          <namespaces>
            <add namespace="System.Web.Optimization" />
            <add namespace="Microsoft.AspNet.Identity" />
          </namespaces>
          <controls>
            <add assembly="Microsoft.AspNet.Web.Optimization.WebForms" namespace="Microsoft.AspNet.Web.Optimization.WebForms" tagPrefix="webopt" />
            <add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" />
          </controls>
        </pages>
        <membership>
          <providers>
            <!--
              ASP.NET Membership is disabled in this template. Please visit the following link http://go.microsoft.com/fwlink/?LinkId=301889 to learn about the ASP.NET Membership support in this template
            -->
            <clear />
          </providers>
        </membership>
        <profile>
          <providers>
            <!--
              ASP.NET Membership Profile is disabled in this template. Please visit the following link http://go.microsoft.com/fwlink/?LinkId=301889 to learn about the ASP.NET Membership support in this template
            -->
            <clear />
          </providers>
        </profile>
        <roleManager>
          <!--
                ASP.NET Membership Role is disabled in this template. Please visit the following link http://go.microsoft.com/fwlink/?LinkId=301889 to learn about the ASP.NET Membership support in this template
            -->
          <providers>
            <clear />
          </providers>
        </roleManager>
        <!--
                If you are deploying to a cloud environment that has multiple web server instances,
                you should change session state mode from "InProc" to "Custom". In addition,
                change the connection string named "DefaultConnection" to connect to an instance
                of SQL Server (including SQL Azure and SQL  Compact) instead of to SQL Server Express.
          -->
        <sessionState mode="InProc" customProvider="DefaultSessionProvider">
          <providers>
            <add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" />
          </providers>
        </sessionState>
      </system.web>
      <system.webServer>
        <modules>
          <remove name="FormsAuthenticationModule" />
        </modules>
      </system.webServer>
      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="WebGrease" culture="neutral" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="Microsoft.WindowsAzure.Storage" publicKeyToken="31bf3856ad364e35" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-2.1.0.4" newVersion="2.1.0.4" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="HtmlAgilityPack" publicKeyToken="bd319b19eaf3b43a" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-1.4.9.0" newVersion="1.4.9.0" />
          </dependentAssembly>
        <dependentAssembly> 
     <assemblyIdentity name="HtmlAgilityPack" publicKeyToken="bd319b19eaf3b43a" culture="neutral" />  
     <bindingRedirect oldVersion="1.4.5.0-1.4.6.0" newVersion="1.4.6.0" /> 
    </dependentAssembly> 
        </assemblyBinding>
      </runtime>
      <entityFramework>
        <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
        <providers>
          <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
        </providers>
      </entityFramework>
    </configuration>
    

    I rebuilt the solution, cleaned it. I don't know what else to do. Any kind of help will be deeply appreciated.

    Error Message:

    Could not load file or assembly 'HtmlAgilityPack, Version=1.4.6.0, Culture=neutral, PublicKeyToken=bd319b19eaf3b43a' or one of its dependencies. The system cannot find the file specified.

  • Kellen Stuart
    Kellen Stuart over 4 years
    I thought the csproj was updated automatically when upgrading nuget packages?