无法加载文件或程序集 HtmlAgilityPack 版本 1.4.6.0

could not load file or assembly HtmAgilityPack verion 1.4.6.0

好的,我已经尝试了互联网上提到的所有方法。我的大部分项目都是在 VS 2013 Express for Web 中完成的。由于它不支持 Crystal 报告,我恢复到 VS2012 Ultimate。它很好地打开了解决方案并且工作正常。我遇到的问题是当我尝试添加报告时,它通过了命名部分,当它即将加载报告页面时它给我以下错误:ErrorLink。 我的工具包在 VS2013 上运行良好。 工具包版本:7.1213 AjaxMin:4.97 HtmlAglilityPack: 1.4.9

我在这里提供我的 web.config 文件:

    <?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>

我重建了解决方案,清理了它。我不知道还能做什么。任何形式的帮助将不胜感激。

错误信息:

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.

我猜是程序集版本的问题。

您指定与以下合作:

HtmlAglilityPack: 1.4.9.0

在您的代码中有以下内容

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

我认为它不应该存在,因为您使用的是较新的版本 1.4.9.0 并且您已经有了该参考。 (我第一次尝试回答时没有注意到这一点)

  <dependentAssembly>
  <assemblyIdentity name="HtmlAgilityPack" publicKeyToken="bd319b19eaf3b43a" culture="neutral" />
  <bindingRedirect oldVersion="0.0.0.0-1.4.9.0" newVersion="1.4.9.0" />
  </dependentAssembly>

好的,我做了很多搜索,感谢@Caleb 和其他人与我一起度过了这一切。我卸载并重新安装了不同版本的 CR。它提出了一些关于某些对象模型库的 COM 错误。我删除了引用和 tada.. 现在工作正常。 不要忘记这样做:

`将 ADO.NET 与 Microsoft .NET Framework 一起使用时 4.0(及更高版本),必须将以下设置添加到应用程序的配置文件中:

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

希望对您有所帮助。

  1. 此问题可能是由于 project.Either 中包含的以下 dll 不匹配而导致 dll/package 中的任何一个丢失或版本不正确,因此请安装或更新该软件包:

AjaxControlToolkit AjaxMin HtmlAgilityPack

工具 -> 库包管理器 -> 包管理器控制台

PM> install-package [正确版本的包名称]

示例:PM> Install-Package HtmlAgilityPack -Version 1.4.6

试试这个!!

1) 只需右键单击您的解决方案

2) 在线搜索 AjaxControlToolkit

3) 点击安装

4) 重启Visual Studio

5)构建 & 运行

一切顺利

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

我尝试清除 Temp 文件夹中的所有临时文件。只需键入 %Temp% 并删除该文件夹中的所有文件。
然后欢呼我的问题解决了。

注意:我尝试了以下但没有奏效:
(i) 重建、重新启动、清理解决方案 + 项目。
(ii) 再次引用其dll。
(iii) 清除路径 C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files 中的数据。
(iv) 下载丢失的包。