【问题标题】:Could not load file or assembly 'AjaxControlToolkit,无法加载文件或程序集“AjaxControlToolkit,
【发布时间】:2011-09-25 19:39:43
【问题描述】:
<tt:TooltipExtender ID="teAutoServiceShutdown" TargetControlID="cbAutoServiceShutdown"

解析器错误消息:无法加载文件或程序集“AjaxControlToolkit,版本=3.0.20820.16598,Culture=neutral,PublicKeyToken=28f01b0e84b6d53e”或其依赖项之一。找到的程序集的清单定义与程序集引用不匹配。 (HRESULT 异常:0x80131040)

怎么办?

【问题讨论】:

  • 好吧,除了reference the 'AjaxControlToolkit, Version=3.0.20820.16598, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e' assembly to your project or put it in the GAC,我真的不知道你对这样的问题期望什么样的答案。

标签: c#


【解决方案1】:

我知道这个问题已经将近一年了,但我自己也遇到了这个问题。我通过简单地执行“构建 - > 清洁解决方案”来解决它,我猜这会清除程序集缓存。

【讨论】:

    【解决方案2】:

    几种可能的方法:

    1. 阅读How the Runtime Locates Assemblies,然后尝试确定一个程序集是否被正确引用并且是否在任何预期的路径中(基本上你可以自己手动完成程序集解析步骤,看看你是否能够自己找到参考; ) )
    2. 从项目文件中删除引用(我相信是web.config),清理解决方案,再次添加引用
    3. 使用 msbuild YourSolution.sln /v:diag &gt; log.txt 命令行手动构建项目,然后查看生成的 log.txt 文件以了解解决程序集引用时的任何问题
    4. 使用 filemon 工具查看 Visual Studio 试图在何处查找文件

    【讨论】:

    • 我将 AjaxControlToolkit 从旧版本更改为新版本。我添加了对项目的新引用,我收到了这个错误。在 web.config 中只有这个
    • @senzacionale :您是否检查过 GAC 中的此程序集,如果是,版本是否最新?另请参阅 web 项目 csproj 文件,它应该包含类似 ..\..\..\..\ThirdParty\AjaxControlToolkit\AjaxControlToolkit.dllCORRECT 提示路径
    【解决方案3】:

    构建输出窗口应该为您提供此问题的修复/解决方法。

    清理并重建解决方案。

    检查输出窗口的内容,查找以下文本:

    Consider app.config remapping of assembly "AjaxControlToolkit, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" from Version "4.1.40412.0" [C:\Visual Studio\App\Lib\bin\Debug\AjaxControlToolkit.dll]
    

    接下来会有一个片段,您可以将其粘贴到 web.config 的 &lt;assemblyBinding&gt; 部分。

    C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1819,5): warning MSB3247: 
    Found conflicts between different versions of the same dependent assembly. 
    In Visual Studio, double-click this warning (or select it and press Enter) to fix the conflicts; 
    otherwise, add the following binding redirects to the "runtime" node in the application configuration file: 
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
            <assemblyIdentity name="AjaxControlToolkit" culture="neutral" publicKeyToken="28f01b0e84b6d53e" />
            <bindingRedirect oldVersion="0.0.0.0-16.1.0.0" newVersion="16.1.0.0" />
        </dependentAssembly>
    </assemblyBinding>
    

    粘贴并重建后,它应该会自动引用指定为 newVersion 的 Toolkit 版本。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-12-26
      • 1970-01-01
      • 1970-01-01
      • 2020-08-17
      相关资源
      最近更新 更多