Reputation: 29421
I want to write a library that leverages functionality from e.g. JSON .NET. Let's say I use version 8.0 of JSON .NET. When I distribute my library, anyone who uses it will have to use the same version of JSON .NET, and it will conflict with any versions they are already using.
I could isolate the serialization part of my library into a separate NuGet package, but that would still be dependent on the particular version.
How can I build my library in such a way that it provides such serialization capabilities out of the box, and yet does not restrict the client code in terms of third party packages? Are there any existing patterns for this kind of thing?
Upvotes: 0
Views: 104
Reputation: 4626
Actually, your assumption is not exactly correct. Other versions of dependencies can be used. In .NET, we use assembly unification to accomplish this. Essentially, the end user's config file can be written to say, "when the code needs version 8.0, it's okay to use 9.0". And most of the time, newer code is written to be reverse compatible.
Ultimately, you can't stress out about it. Comes with the territory.
Upvotes: 1