I have a custom .NET assembly with some powershell cmdlets than I use for common domain related tasks. I've just created a new cmdlet that references a 3rd party library that has a reference to Newtonsoft.Json 4.5.0.0. However one of my other projects uses the latest version of json.net (6.0.0.0). So at runtime in powershell fusion throws an error saying it can't load newtonsoft.json 4.5.0.0.
I've tried creating a powershell.exe.config and putting an assembly redirect in there:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json", Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed/>
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
but this doesn't seem to work. The fusion log does state that it is looking in this new config file for powershell but it doesn't seem to be picking up the redirect.
Bit stumped for solutions here. Any clues what the problem might be? This same redirect works in some of my business services that would otherwise have the same issue (they also use this 3rd party lib and json.net 6).
Cheers
See Question&Answers more detail:os