C# 无法加载文件或程序集“AjaxMin,版本=4.97.4951.28478,Culture=neutral,PublicKeyToken=21ef50ce11b5d80f”或其依赖项之一

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19920806/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-10 16:08:12  来源:igfitidea点击:

Could not load file or assembly 'AjaxMin, Version=4.97.4951.28478, Culture=neutral, PublicKeyToken=21ef50ce11b5d80f' or one of its dependencies

c#.netajaxcontroltoolkit

提问by stroopwafel

Get this error when I try to view my project in browser on localhost.

当我尝试在本地主机上的浏览器中查看我的项目时出现此错误。

Verified that AjaxControlToolkit is setup in references in my project.

验证 AjaxControlToolkit 已在我的项目的引用中设置。

AjaxControlToolkit.dll is in the directory listed in the reference.

AjaxControlToolkit.dll 位于参考中列出的目录中。

I re-installed AjaxControlToolkit to make sure that was not the issue.

我重新安装了 AjaxControlToolkit 以确保这不是问题。

The project I am working on is a project emailed to me by a colleague and is not something I created from the ground up. Not sure if that is the problem and the project is looking at an old reference?

我正在从事的项目是一个同事通过电子邮件发送给我的项目,并不是我从头开始创建的项目。不确定这是否是问题所在,并且该项目正在查看旧参考资料?

On a related note, I have another test project in a separate solution and I added an AjaxControlToolkit control to test that (CalendarExtender) and it worked just fine.

在相关说明中,我在一个单独的解决方案中有另一个测试项目,我添加了一个 AjaxControlToolkit 控件来测试它(CalendarExtender)并且它工作得很好。

Posting my code:

发布我的代码:

web config:

网络配置:

 <?xml version="1.0"?>
    <configuration>
      <connectionStrings>
        <add name="TESTConnectionString" connectionString="Data Source=(localdb)\v11.0;Initial Catalog=TEST;Integrated Security=True" providerName="System.Data.SqlClient"/>
        <add name="TESTConnectionString2" connectionString="Data Source=(localdb)\v11.0;Initial Catalog=TEST;Integrated Security=True" providerName="System.Data.SqlClient"/>
      </connectionStrings>
      <system.web>
        <httpRuntime targetFramework="4.5" />
        <compilation debug="true" targetFramework="4.5">

          <assemblies>
            <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
            <add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>



          </assemblies>



       </compilation>

        <!--<pages>-->
          <!--<controls>

            <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=4.97.4951.28478, Culture=neutral, PublicKeyToken=21ef50ce11b5d80f" />
            <add namespace="AjaxControlToolkit" assembly="AjaxControlToolkit" tagPrefix="asp" />

            --><!--<add namespace="AjaxControlToolkit, Version=4.97.4951.28478, Culture=neutral, PublicKeyToken=21ef50ce11b5d80f"/>
            <add tagPrefix="asp" namespace="AjaxControlToolkit" assembly="AjaxControlToolkit, Version=4.97.4951.28478, Culture=neutral, PublicKeyToken=21ef50ce11b5d80f"/>--><!--
          </controls>
        </pages>-->

      </system.web>
    </configuration>

master page:

母版页:

 <%@ Master Language="C#" %>



    <!DOCTYPE html>
    <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <meta charset="utf-8" />    
        <title></title>
        <asp:ContentPlaceHolder id="head" runat="server" />

    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <%--<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>--%>

            <%--<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>--%>
            <asp:ContentPlaceHolder id="Content2" runat="server" />
            <asp:UpdatePanel ID="UpdatePanel1" runat="server" />

        </div>
        </form>
    </body>
    </html>

top of the main .aspx page through the toolkitscriptmanager tag:

通过 toolkitscriptmanager 标记在主 .aspx 页面的顶部:

  <%@ Page Title="" Language="C#" MasterPageFile="MasterPage.master" AutoEventWireup="true" CodeFile="MAIN.aspx.cs" Inherits="admin_Payments" %>


    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix ="asp" %>


    <asp:Content  ContentPlaceHolderID="head" runat="Server">




        <style type="text/css">
            .auto-style1 {
                text-align: left;
                font-size: medium;
            }

            .auto-style2 {
                font-size: medium;
            }

            .auto-style3 {
                height: 577px;
            }
        </style>
    </asp:Content>

    <asp:Content contentplaceholderid="Content2" runat="Server">

        <asp:UpdatePanel ID="UpdatePanel1" runat="server">

        <ContentTemplate>

            <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
    </asp:ToolkitScriptManager>

..................

………………

采纳答案by stroopwafel

Here is the answer. Apparently this was missing. Did as instructed and it worked. Install AjaxMin package

这是答案。显然这是缺失的。按照指示做了,它奏效了。安装 AjaxMin 包

Thanks to all who commented!

感谢所有评论的人!

回答by Ben

Referencing the AjaxMin.dll did it for me. It comes with the Ajax download: http://ajaxcontroltoolkit.codeplex.com/releases/view/612416

引用 AjaxMin.dll 为我做到了。它带有 Ajax 下载:http: //ajaxcontroltoolkit.codeplex.com/releases/view/612416

回答by mzonerz

on your nuget console

在你的 nuget 控制台上

Install-Package AjaxMin