Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use different versions of dll file in one app

I have an c# application with two libraries ( moon-apns, tweetsharp ) .. Each library has a reference for newtonsoft.json.dll but different versions ... My app build successfully but one library works fine and the other one throws an exception ( can't find the dll file ).

I think that when i build only one version goes to the bin folder, but i don't know what to do.

Thanks in advance.

like image 963
Islam Ahmed Avatar asked Mar 29 '13 13:03

Islam Ahmed


2 Answers

You can force both libraries to reference the same version by using Assembly Binding Redirects in your app.config or web.config. Obviously this only works as long as the library versions are compatible.

like image 177
Rytmis Avatar answered Oct 14 '22 07:10

Rytmis


Since you stated you have access to the source of the two libraries:

In both projects, set the reference to newtonsoft to not required Specific Version. Rebuild those projects.

Now, when you build your main project, the two libraries should be ok with the same version of the newtonsoft DLL as long as there is no compatibility issues

like image 26
JeremyK Avatar answered Oct 14 '22 06:10

JeremyK