1

I am using a CMS, proprietary, and trying to add the Google APIs for YouTube.

The CMS requires Newtonsoft.Json 4.5. Google's APIs .NET requires Newtonsoft.Json 10.0.

I thought of trying to build a separate "webpage" for the YouTube upload and put it in an iFrame, but this will remove it from my form. I don't see an effective way of doing that.

Can I somehow provide the proprietary CMS with the file it needs (and ships with) while giving the Google API the file it needs?

Chad
  • 1,139
  • 17
  • 41
  • Why can the CMS not use 10.0? – Sasha Mar 12 '18 at 12:54
  • AFAIK, not in the same AppDomain – Camilo Terevinto Mar 12 '18 at 12:55
  • @Jaxi because it is the worst piece of software I have ever dealt with! :endRant: I am working to replace it, but it will be a few years worth of work. In the meantime.... (FYI it's called RiSE and is part of iMIS) – Chad Mar 12 '18 at 12:58
  • 3
    Have you tried using [assembly binding redirects](https://learn.microsoft.com/en-us/dotnet/framework/configure-apps/redirect-assembly-versions) to force your application's dependencies to use the same version of `Newtonsoft.Json`? – NightOwl888 Mar 12 '18 at 12:59
  • @NightOwl888 Thanks for the link, I think that has worked! – Chad Mar 12 '18 at 13:30

1 Answers1

1

You don't need to use 2 different versions of Newtonsoft.Json. Instead, you can use assembly binding redirects to force your dependencies to use the same version.

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
            <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30AD4FE6B2A6AEED" culture="neutral"/>
            <bindingRedirect oldVersion="0.0.0.0-11.0.1.0" newVersion="11.0.1.0"/>
        </dependentAssembly>
    </assemblyBinding>
</runtime>

Reference: Newtonsoft.json assembly package version mismatch

NightOwl888
  • 55,572
  • 24
  • 139
  • 212