We implemented Azure Keyvault and MSAL authentication in one of our asp.net web forms application. Whereas MSAL is working as expected after installing all owin secirity packages and newtonsoft json package is upgraded from 6.0.0.0 to 10.0.0 version. But while fetching secrets from keyvault, application is encountered with following newtonsoft.json dll missing error.
System.IO.FileLoadException: 'Could not load file or assembly 'Newtonsoft.Json, Version=6.0.0.0, 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)'
LOG: This bind starts in default load context. LOG: Using application configuration file: C:\Users\v-tukar\source\repos\DWS-CPM-PLG-ETRAX-CoreCode8\Web\Microsoft.IT.eTRAx.UX\web.config LOG: Using host configuration file: C:\Users\v-tukar\Documents\IISExpress\config\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=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed LOG: Attempting download of new URL file:///C:/Users/v-tukar/AppData/Local/Temp/Temporary ASP.NET Files/vs/27ddedce/76380321/Newtonsoft.Json.DLL. LOG: Attempting download of new URL file:///C:/Users/v-tukar/AppData/Local/Temp/Temporary ASP.NET Files/vs/27ddedce/76380321/Newtonsoft.Json/Newtonsoft.Json.DLL. LOG: Attempting download of new URL file:///C:/Users/v-tukar/source/repos/DWS-CPM-PLG-ETRAX-CoreCode8/Web/Microsoft.IT.eTRAx.UX/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.
Note: 1.We have upgraded all keyvault related dll's to latest version(Microsoft.Rest.ClientRuntime.Azure to Version=3.3.18 and Microsoft.Rest.ClientRuntime to 2.3.17) 2.We could see upgraded dll versions in web.config and packages.config file. Also we have checked if any other dll's in the project are dependent on Newtonsoft.Json 6.0.0.0 version dll but we could not find any.
Still we are encountering Newtonsoft.Json dll 6.0.0.0 version error. It will very helpful if anybody could suggest a solution on this
The thing here is, you are using Newtonsoft.json
in 3 Nugets in your project -
AFAIK, there can be 2 possible solutions to this:
<package id="Newtonsoft.Json" version="10.0.1" targetFramework="net472" />
in packages.json
.User contributions licensed under CC BY-SA 3.0