We have a WebForms web project that used to use ASP.NET 4.0 but was using version 3.5.60623.0 of the Ajax Control Toolkit. We recently changed the project to use ASP.NET 4.5 and swapped the AjaxControlToolkit with version 4.5.7.123. I registered this assembly
in the web.config, like this (no version specified):
<httpRuntime targetFramework="4.5" />
<pages controlRenderingCompatibilityVersion="4.0">
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add tagPrefix="act" namespace="AjaxControlToolkit" assembly="AjaxControlToolkit" />
</controls>
</pages>
We have code that logs all unhandled exceptions in our application and I've been seeing several exceptions like this below:
Exception Type: System.IO.FileLoadException
Message: Could not load file or assembly 'AjaxControlToolkit, Version=3.5.60623.0, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e' or one of its dependencies. The located assembly's manifest definition does not match the assembly
reference. (Exception from HRESULT: 0x80131040)
Source: mscorlib
Stack Trace:
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean
forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean
suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
at AjaxControlToolkit.ToolkitScriptManager.ScriptEntry.LoadAssembly()
at AjaxControlToolkit.ToolkitScriptManager.DeserializeScriptEntries(String serializedScriptEntries, Boolean loaded)
at AjaxControlToolkit.ToolkitScriptManager.OutputCombinedScriptFile(HttpContext context)
at AjaxControlToolkit.ToolkitScriptManager.OnInit(EventArgs e)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
I've double-checked the project settings to make sure that the correct version is referenced and that there are no other referenced assemblies that use the old version of the AjaxControlToolkit. What's odd is that I've browsed to the page and don't see
this exception so I cannot replicate it. I've gone through the code of the page in question, as well as the master page and any possible controls used within. The master page contains a ToolkitScriptManager as opposed to a ScriptManager per the recommendations
for this version and we are not accessing the ToolkitScriptManager in the code-behind.
Any idea what might be going on here?