West Wind .NET Tools and Demos
Could not load file or assembly "newtonsoft.Json"
Gravatar is a globally recognized avatar based on your email address. Could not load file or assembly "newtonsoft.Json"
  Phil Sherwood
  All
  Jul 31, 2024 @ 03:42am

I run into this problem about once a year and have notes on how to fix it (usually). This time my fixes don't work.

Here's the message I get:

I've got this in both my VFP.EXE.Config and myapp.exe.config.

<?xml version="1.0"?>
<configuration>
  <startup>   
	<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
  </startup>
  <runtime>
      <loadFromRemoteSources enabled="true"/>
  </runtime>
  
  <runtime>    
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-13.0.3" newVersion="13.0.3" />
      </dependentAssembly>
	</assemblyBinding>  
  </runtime>
</configuration>

In my Bin folder I have the following:

wwdotnetbridge.dll - Version 7.35

wwipstuff.dll. - Version 7.35

newtonsoft.json.dll - Version 13.03

What else should I add to my notes to fix this the next time it happens?

Thanks!

Phil

Gravatar is a globally recognized avatar based on your email address. re: Could not load file or assembly "newtonsoft.Json"
  Rick Strahl
  Phil Sherwood
  Jul 31, 2024 @ 07:10am

The issue I think is that you need to use the AssemblyVersion not the FileVersion, which are slightly different.

Try using 13.0.0.0 for the newVersion and last version.

I make this mistake all the time too, and it's a pain since the Assembly version requires you to use a special tool that understands .NET binaries - it's not the version that shows when you view file details.

I should update the blog post and help topic in that respect.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Could not load file or assembly "newtonsoft.Json"
  Phil Sherwood
  Rick Strahl
  Jul 31, 2024 @ 10:00am

That fixed it. Now I've got updated notes for the next time.

Thanks!

Phil

© 1996-2024