tweetmoasharp icon indicating copy to clipboard operation
tweetmoasharp copied to clipboard

Assembly Newtonsoft.Json Issue.

Open MAKARANDKURKUTE opened this issue 3 years ago • 1 comments

I recently updated Newtonsoft.Json assembly with 12.0.0.0 with TweetSharp 6.0.2.0. I have other projects which are dependent on latest Newtonsoft.Json12.0.0.0 version.

I am getting following error with Tweeter API.

Could not load file or assembly 'Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.

Tried by changing app.config by adding bindingRedirect oldVersion="0.0.0.0-11.0.0.0" to Newtonsoft.Json but not working.

also tried by creating TweetSharp.dll.config with oldVersion setting but not working.

Any suggestion, How can I fix this issue?

Thanks in advance, -Mak

MAKARANDKURKUTE avatar Mar 04 '21 07:03 MAKARANDKURKUTE

@MAKARANDKURKUTE I had the same issue. From reading https://docs.microsoft.com/en-us/nuget/consume-packages/package-references-in-project-files#controlling-dependency-assets , I learned that you can control which dependency should flow to the parent project.

In this case, we don't want Newtonsoft.Json 11.0.0.0 to flow to our project.

This line works for me <PackageReference Include="TweetMoaSharp" Version="6.0.2" PrivateAssets="Newtonsoft.Json" />

If anyone finds a better solution, please let me know 😉

Liebeck avatar Jan 30 '22 10:01 Liebeck