1

I am trying to create a class library which will be used in different projects

Example:

I am creating math.dll which uses add.dll(v2), subtract.dll(v2).

The math.dll will be used by other projects which might already be using add.dll and subtract.dll which again can be any version lower or higher. (add.dll - v1, subtract.dll - v3)

One resolution to avoid any issues is to add binding redirects in web.config to use the version that the project already has.

Is there a way to avoid issues without binding redirects? (i have 10+ dll references in my class library project and i might add more). I don’t want other projects consuming my dll to add all the binding redirects.

Is it possible for my dll to use dlls (add/subtract) from the project that's consuming it?

Is there a way i can copy over my dependency dlls (add.dll - v2/ subtract -v2) to a folder in the consuming project and refer it from there and not from what the consuming project already has?

Thanks for your help!

zsri
  • 43
  • 1
  • 5
  • I don't understand your last question. Your project will only use the DLL's you tell it to. – hoodaticus Jun 27 '17 at 17:22
  • i have updated my question. thanks! – zsri Jun 27 '17 at 18:25
  • you are attempting to bypass a version safety feature. From Microsoft's perspective there's no guarantee that a new version of a DLL has anything other than a name in common with the old one. The binding redirects help ensure that you have tested and confirmed your compatibility story. As such, the solutions for bypassing it are painful. I am marking this question as a duplicate. – hoodaticus Jun 27 '17 at 18:28
  • 2
    Possible duplicate of [Can I have my assembly reference any version of another assembly?](https://stackoverflow.com/questions/24048277/can-i-have-my-assembly-reference-any-version-of-another-assembly) – hoodaticus Jun 27 '17 at 18:28
  • hi @hoodaticus, i have added one more question to my list, can you please take a look and let me know if that's possible? Thanks! – zsri Jun 27 '17 at 18:41
  • it is possible to just use the types in an already-loaded assembly but this requires late binding which is painful to use. It would be easier for you to create your own AppDomain, load all your dependencies into it, then the DLL you publish to users would forward all calls across from their AppDomain to yours using a request-reply model. This has a performance overhead though. – hoodaticus Jun 27 '17 at 18:48

0 Answers0