Programming

Could not load file or assembly NewtonsoftJson or one of its dependencies Manifest definition does not match the assembly reference

19 September 2026 · 13 min read

Could not load file or assembly NewtonsoftJson or one of its dependencies Manifest definition does not match the assembly reference

Encountering the dreaded error “Could not load file or assembly ‘Newtonsoft.Json’ or one of its dependencies. Manifest definition does not match the assembly reference” can be a frustrating experience for .NET developers. This error typically arises during runtime, halting your application and leaving you scrambling for a solution. It signals a version mismatch or incompatibility issue between the Newtonsoft.Json library your application relies on and the version specified in your project’s configuration or the global assembly cache (GAC). This mismatch can occur due to various reasons, including incorrect assembly binding redirects, conflicting NuGet package versions, or outdated dependencies. Understanding the root cause and implementing the appropriate fix is crucial to restoring your application’s functionality and preventing future occurrences of this common, yet perplexing, error. It’s a situation where careful dependency management and a systematic approach to debugging are essential skills.

Understanding the ‘Newtonsoft.Json’ Assembly Error

The “Could not load file or assembly ‘Newtonsoft.Json’ or one of its dependencies. Manifest definition does not match the assembly reference” error essentially means that the version of the Newtonsoft.Json library that your application is trying to load doesn’t match the version that’s expected based on your project’s configuration. This discrepancy can stem from a few key areas. First, consider NuGet package management. NuGet manages the dependencies for your .NET projects, but sometimes, dependencies can become inconsistent if packages are added or updated without careful consideration of their compatibility. For example, if two different packages require different versions of Newtonsoft.Json, NuGet might not always resolve the conflict correctly, leading to this error. Secondly, assembly binding redirects play a crucial role. These redirects, defined in your application’s configuration file (app.config or web.config), instruct the .NET runtime to load a specific version of an assembly instead of the one originally referenced. If these redirects are missing, incorrect, or pointing to the wrong version, the error will occur.

Another potential source of the problem lies in the Global Assembly Cache (GAC). The GAC is a central repository for assemblies that can be shared by multiple applications. If an older or incompatible version of Newtonsoft.Json is present in the GAC, it might override the version specified in your project’s local dependencies. This is especially likely if you’ve manually installed Newtonsoft.Json into the GAC in the past. Finally, build configurations and project settings can also contribute to the problem. Ensure that your project is configured to copy local copies of the Newtonsoft.Json assembly to the output directory. If this setting is disabled, your application might be attempting to load the assembly from a location where it doesn’t exist or has an outdated version.

Featured Snippet: The error “Could not load file or assembly ‘Newtonsoft.Json’ or one of its dependencies. Manifest definition does not match the assembly reference” indicates a version conflict. It means that your application is referencing a version of Newtonsoft.Json different from the one it’s actually finding at runtime. Fixing this usually involves ensuring all projects in your solution use the same Newtonsoft.Json version, employing assembly binding redirects in your app.config or web.config file to force the use of a specific version, or removing conflicting references from the Global Assembly Cache (GAC).

Troubleshooting and Resolving the Issue

Resolving the “Could not load file or assembly ‘Newtonsoft.Json’ or one of its dependencies. Manifest definition does not match the assembly reference” error requires a systematic approach. Start by checking your NuGet package references. Open the NuGet Package Manager in Visual Studio and verify that all projects within your solution are using the same version of Newtonsoft.Json. If different projects reference different versions, update them to a consistent version. It’s generally recommended to use the latest stable version of Newtonsoft.Json to take advantage of bug fixes and performance improvements. However, ensure that any other libraries or components you’re using are compatible with the chosen version. Use the Package Manager Console to update the packages: Update-Package Newtonsoft.Json -Version [DesiredVersion]

Next, examine your application’s configuration file (app.config or web.config) for assembly binding redirects. These redirects tell the .NET runtime which version of an assembly to load. The redirects should accurately reflect the version of Newtonsoft.Json that you’re using. If the redirects are missing or incorrect, add or modify them accordingly. You can automatically generate binding redirects by right-clicking on your project in Visual Studio and selecting “Add” -> “New Item…” -> “Application Configuration File”. Then, in the app.config file, ensure the section contains the correct redirect for Newtonsoft.Json. Manually check for the correct publicKeyToken and culture attributes.

Finally, investigate the Global Assembly Cache (GAC). If an older version of Newtonsoft.Json is present in the GAC, it might be interfering with your application. You can view the contents of the GAC using the Assembly Cache Viewer (shfusion.dll). To access it, open the Visual Studio Developer Command Prompt and type gacutil /l Newtonsoft.Json. If you find an outdated version, you can remove it using the gacutil /u Newtonsoft.Json command. However, exercise caution when modifying the GAC, as incorrect changes can affect other applications on your system. Remember to restart your application and even your machine after making changes to the GAC.

Best Practices for Dependency Management

Preventing the “Could not load file or assembly ‘Newtonsoft.Json’ or one of its dependencies. Manifest definition does not match the assembly reference” error starts with adopting robust dependency management practices. Centralize your NuGet package management. Use a single NuGet package source for all your projects to ensure consistency and avoid conflicts. Consider using a private NuGet feed for internal libraries and dependencies. This provides greater control over versioning and distribution.

Implement continuous integration and continuous deployment (CI/CD) pipelines. These pipelines can automatically detect dependency conflicts and integration issues early in the development cycle, allowing you to address them before they reach production. Regularly update your dependencies. Keep your NuGet packages up to date with the latest stable versions to benefit from bug fixes, performance improvements, and security patches. However, always test updates thoroughly in a staging environment before deploying them to production to ensure compatibility.

Use semantic versioning (SemVer) to manage your own libraries and dependencies. SemVer provides a standardized way to communicate the significance of changes in each version, making it easier for consumers to understand the potential impact of upgrades. For example, a major version bump (e.g., 1.x.x to 2.x.x) indicates breaking changes, while a minor version bump (e.g., 1.1.x to 1.2.x) indicates new features that are backward-compatible. Patch version bumps (e.g., 1.1.1 to 1.1.2) are generally for bug fixes. Use strong naming for your assemblies. Strong naming provides a unique identity for your assemblies, preventing name collisions and ensuring that the correct version is loaded at runtime.

  • Always use a consistent version of Newtonsoft.Json across all projects in your solution.
  • Carefully manage assembly binding redirects in your app.config or web.config file.

Advanced Scenarios and Solutions

In some cases, the “Could not load file or assembly ‘Newtonsoft.Json’ or one of its dependencies. Manifest definition does not match the assembly reference” error can be more complex and require advanced troubleshooting techniques. One such scenario involves dealing with legacy code or third-party libraries that have hard dependencies on specific versions of Newtonsoft.Json. In these situations, you might not be able to simply upgrade to the latest version without breaking compatibility. A potential solution is to use assembly binding redirects to force the legacy code to use a newer version of Newtonsoft.Json, but this approach requires careful testing to ensure that the legacy code continues to function correctly.

Another challenging scenario arises when working with plug-in architectures. If your application uses plug-ins that load Newtonsoft.Json independently, you might encounter version conflicts if the plug-ins use different versions of the library. One way to address this is to isolate the plug-ins into separate application domains (AppDomains). Each AppDomain can have its own set of dependencies, preventing version conflicts between plug-ins. Another approach is to use a shared library that provides a common interface for accessing Newtonsoft.Json, allowing the plug-ins to use a consistent version of the library.

When all else fails, consider using dependency injection (DI) to manage your dependencies. DI allows you to inject the required dependencies into your classes, rather than relying on static references. This makes it easier to swap out different versions of dependencies without modifying your code. Popular DI frameworks for .NET include Autofac, Ninject, and Microsoft.Extensions.DependencyInjection. These frameworks provide features like automatic dependency resolution and lifetime management, simplifying the process of managing complex dependencies.

  1. Check NuGet package versions across all projects.
  2. Examine assembly binding redirects in app.config or web.config.
  3. Investigate the Global Assembly Cache (GAC).
  4. Consider using separate AppDomains for plug-ins.

FAQ on Newtonsoft.Json Assembly Loading Issues

What is the most common cause of the "Could not load file or assembly 'Newtonsoft.Json'" error?
The most common cause is a version mismatch between the Newtonsoft.Json library referenced by your project and the version actually loaded at runtime. This can happen due to conflicting NuGet packages, incorrect assembly binding redirects, or outdated versions in the GAC.
How do I check which version of Newtonsoft.Json is being used by my application?
You can check the version by examining the references in your project in Visual Studio. Also, you can inspect the loaded assemblies at runtime using the debugger.
What are assembly binding redirects, and how do they help?
Assembly binding redirects are configuration settings that tell the .NET runtime to load a specific version of an assembly instead of the one originally referenced. They help resolve version conflicts and ensure that your application uses the correct version of Newtonsoft.Json. More information is available on the [Microsoft documentation website](https://learn.microsoft.com/en-us/dotnet/framework/configure-apps/redirect-assembly-versions).
Should I always use the latest version of Newtonsoft.Json?
While it's generally a good practice to use the latest stable version, ensure that your other libraries and components are compatible with the chosen version. Thoroughly test updates in a staging environment before deploying them to production.
- Dependency Injection - Separate AppDomains

The journey to resolve the “Could not load file or assembly ‘Newtonsoft.Json’ or one of its dependencies. Manifest definition does not match the assembly reference” error can be challenging, but with a systematic approach and a solid understanding of .NET dependency management, it’s definitely conquerable. Remember to double-check those NuGet packages, scrutinize your assembly binding redirects, and be wary of the GAC. By implementing the best practices discussed, you’ll not only fix the immediate problem but also build a more robust and maintainable application in the long run. For further reading on dependency management, explore resources like NuGet’s official documentation and articles on assembly binding. Also, check Stack Overflow for detailed discussions and solutions here.

If you’re still struggling with this error, consider seeking assistance from experienced .NET developers or consultants. They can provide expert guidance and help you identify the root cause of the problem. And, of course, always remember to document your findings and solutions to prevent future occurrences. Now that you’re armed with this knowledge, why not check out our article on best practices for .NET error handling?

Question & Answer :
Things I’ve tried after searching:

  1. in Web.Config put a binding on the old version:

    <dependentAssembly> <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.1.0" /> </dependentAssembly> 
    
  2. Edit my .csproj file to make sure there is only one Newtonsoft reference

    <Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <HintPath>..\packages\Newtonsoft.Json.6.0.1\lib\net45\Newtonsoft.Json.dll</HintPath> <SpecificVersion>False</SpecificVersion> <Private>True</Private> </Reference> 
    
  3. Search my computer for every Newtonsoft.Json.dll and delete every non 6.0.1 version and delete the contents of my temp folder

  4. Repair/Reinstall the package in nuget manager console

It succeeds on building, but gets the error when going to the site.

EDIT

ok, so then I tried to reinstall like every nuget package, and it seems to have added back the 4.5 version of the newtonsoft.json.dll, but I’m getting the same error. My project’s Target freamework is .NET 4.5.1 and here is the stack trace I’m getting now:

Server Error in ‘/’ Application.

Could not load file or assembly Newtonsoft.Json or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.FileLoadException: Could not load file or assembly Newtonsoft.Json or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Assembly Load Trace: The following information can be helpful to determine why the assembly Newtonsoft.Json could not be loaded.

=== Pre-bind state information === LOG: DisplayName = Newtonsoft.Json (Partial) WRN: Partial binding information was supplied for an assembly: WRN: Assembly Name: Newtonsoft.Json | Domain ID: 2 WRN: A partial bind occurs when only part of the assembly display name is provided. WRN: This might result in the binder loading an incorrect assembly. WRN: It is recommended to provide a fully specified textual identity for the assembly, WRN: that consists of the simple name, version, culture, and public key token. WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue. LOG: Appbase = file:///c:/users/user/documents/visual studio 2013/Projects/foo/bar/ LOG: Initial PrivatePath = c:\users\user\documents\visual studio 2013\Projects\foo\bar\bin Calling assembly : (Unknown). === LOG: This bind starts in default load context. LOG: Using application configuration file: c:\users\user\documents\visual studio 2013\Projects\foo\bar\web.config LOG: Using host configuration file: C:\Users\user\Documents\IISExpress\config\aspnet.config LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind). LOG: Attempting download of new URL file:///C:/Users/user/AppData/Local/Temp/1/Temporary ASP.NET Files/root/48686d37/9d7a6572/Newtonsoft.Json.DLL. LOG: Attempting download of new URL file:///C:/Users/user/AppData/Local/Temp/1/Temporary ASP.NET Files/root/48686d37/9d7a6572/Newtonsoft.Json/Newtonsoft.Json.DLL. LOG: Attempting download of new URL file:///c:/users/user/documents/visual studio 2013/Projects/foo/bar/bin/Newtonsoft.Json.DLL. LOG: Using application configuration file: c:\users\user\documents\visual studio 2013\Projects\foo\bar\web.config LOG: Using host configuration file: C:\Users\user\Documents\IISExpress\config\aspnet.config LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. LOG: Redirect found in application configuration file: 4.5.0.0 redirected to 6.0.1.0. LOG: Post-policy reference: Newtonsoft.Json, Version=6.0.1.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed LOG: Attempting download of new URL file:///C:/Users/user/AppData/Local/Temp/1/Temporary ASP.NET Files/root/48686d37/9d7a6572/Newtonsoft.Json.DLL. LOG: Attempting download of new URL file:///C:/Users/user/AppData/Local/Temp/1/Temporary ASP.NET Files/root/48686d37/9d7a6572/Newtonsoft.Json/Newtonsoft.Json.DLL. LOG: Attempting download of new URL file:///c:/users/user/documents/visual studio 2013/Projects/foo/bar/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. 

Stack Trace:

[FileLoadException: Could not load file or assembly 'Newtonsoft.Json' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)] [FileLoadException: Could not load file or assembly 'Newtonsoft.Json, Version=6.0.1.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)] System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0 System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +34 System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +152 System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +77 System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +16 System.Reflection.Assembly.Load(String assemblyString) +28 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +38 [ConfigurationErrorsException: Could not load file or assembly 'Newtonsoft.Json, Version=6.0.1.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)] System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +752 System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +218 System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +130 System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +170 System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +91 System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +285 System.Web.Compilation.BuildManager.ExecutePreAppStart() +153 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +516 [HttpException (0x80004005): Could not load file or assembly 'Newtonsoft.Json, Version=6.0.1.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)] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9913572 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254 Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18408 

To solve this, I ensured all my projects used the same version by running the following command and checking the results:

update-package Newtonsoft.Json -reinstall 

And, lastly I removed the following from my web.config:

<dependentAssembly> <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" /> </dependentAssembly> 

If you want to ensure all your Newtonsoft.Json packages are the same version, you can specify the version like so:

update-package Newtonsoft.Json -version 6.0.0 -reinstall 

Note: To open the PMC in Visual Studio, click Tools -> Nuget Package Manager -> Package Manager Console. Thanks @Rose!