Currently our team is maintaining an old codebase built on an old, pre-compiled Web Forms CMS (iAPPS) that we no longer have support for. We're trying to migrate away from this old CMS, but during that time, we still need to keep maintaining it. At this point in time, we're trying to add some CC gateway functionality, but the SDK from the vendor (GlobalPay) requires Newtonsoft.Json 184.108.40.206 while our legacy code is using 220.127.116.11.
Any time we try to upgrade Newtonsoft, we get the following error:
Could not load file or assembly 'Newtonsoft.Json, Version=18.104.22.168, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
We also get warnings in the build output about using the app.config to remap from one version to another.
I've tried remapping with an app config, no dice. I've tried upgrading all of the projects in the solution, no good. I've checked the .csproj files and they're actually updating just fine when I use NuGet to download Newtonsoft.
One of the major concerns is that this original codebase actually isn't even using NuGet; all of the DLLs of the project are managed manually. I've tried both using NuGet as well as just manually updating the Newtonsoft DLL.
Beyond that, my concern has become that maybe the precompiled CMS somehow strictly expects 22.214.171.124 and won't run unless that specific version is being used. I'm hoping someone out there may have some other path in mind that I haven't found in my searching. We've been dealing with this problem for 2 years and it's finally reached a point of becoming a real blocker that we can't work around.
Below is the Stack Trace:
[FileLoadException: Could not load file or assembly 'Newtonsoft.Json, Version=126.96.36.199, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)] System.Net.Http.Formatting.JsonMediaTypeFormatter..ctor() +0 System.Net.Http.Formatting.MediaTypeFormatterCollection.CreateDefaultFormatters() +41 System.Web.Http.HttpConfiguration.DefaultFormatters() +23 System.Web.Http.HttpConfiguration..ctor(HttpRouteCollection routes) +44 System.Web.Http.GlobalConfiguration.<.cctor>b__0() +55 System.Lazy`1.CreateValue() +429 System.Lazy`1.LazyInitValue() +158 System.Lazy`1.get_Value() +79 System.Web.Http.GlobalConfiguration.get_Configuration() +27 Bridgeline.iAppsCMSAPI.Web.GlobalAsaxModule.Init(HttpApplication httpApplication) +374 System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo handlers) +552 System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo handlers, IntPtr appContext, HttpContext context) +181 System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +228 System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +314 [HttpException (0x80004005): Could not load file or assembly 'Newtonsoft.Json, Version=188.8.131.52, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +10072388 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +99 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +263
And here is my Assembly Load Trace:
=== Pre-bind state information === LOG: DisplayName = Newtonsoft.Json, Version=184.108.40.206, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed (Fully-specified) LOG: Appbase = file:///C:/Users/username/repos/iAPPS/CMSFrontEnd/ LOG: Initial PrivatePath = C:\Users\username\repos\iAPPS\CMSFrontEnd\bin Calling assembly : System.Net.Http.Formatting, Version=220.127.116.11, Culture=neutral, PublicKeyToken=31bf3856ad364e35. === LOG: This bind starts in default load context. LOG: Using application configuration file: C:\Users\username\repos\iAPPS\CMSFrontEnd\web.config LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet.config LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. LOG: Post-policy reference: Newtonsoft.Json, Version=18.104.22.168, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/993da2ea/aabe287a/Newtonsoft.Json.DLL. LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/993da2ea/aabe287a/Newtonsoft.Json/Newtonsoft.Json.DLL. LOG: Attempting download of new URL file:///C:/Users/username/repos/iAPPS/CMSFrontEnd/bin/Newtonsoft.Json.DLL. WRN: Comparing the assembly name resulted in the mismatch: Major Version ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
While writing this, I also tried manually changing the only 22.214.171.124 project reference I could find to the 126.96.36.199 file; no good there.
Short of trying to add the GlobalPay DLLs manually or just telling my management that we've officially hit a deadlock with this codebase, I'm running out of ideas.
Have you checked your web.config at the
There should be an entry for Newtonsoft
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-188.8.131.52" newVersion="184.108.40.206" /> </dependentAssembly> </assemblyBinding>
that section is probably pointing to
220.127.116.11 on your system, change it to
18.104.22.168 and see if that helps
User contributions licensed under CC BY-SA 3.0