Different versions of Enterprise Library in one process
Asked Answered
S

1

7

We are developing an add-in for Autodesk Inventor. Our software is a bunch of dll assemblies loaded into Inventor at runtime. We have decided to use the Microsoft Enterprise Library 5.0 for logging and exception handling.

Now we have a problem, because it turns out Inventor 2013 uses Enterprise Library 4.1. When our add-in is loading, it fails to load the proper version of an assembly, because Inventor already has an older version in its Bin directory.

Options we have considered so far:

  1. During deployment of our product, overwrite the old libraries in Inventor's Bin folder
  2. Use EL 4.1 in our assemblies

Both are bad and I'm running out of ideas, so I'm asking for help.

Option 1 raises this question: is the Enterprise Library backwards compatible and will replacing those DLL's in the Bin folder cause problems? I have tried it, Inventor doesn't complain and works as expected (haven't checked the EL functionality).

Option 2 makes us use the older version and binds us to the version Autodesk is using, so we would have to watch when they upgrade, especially when they release a new version of Inventor.

What is the best practice in this scenario?

UPDATE:
We solved this by just putting the newer version of Enterprise Library in GAC. I think what happened here was that .NET tried loading the older version first (because it was higher in assembly search order) and after failing never went any further to look for the proper version. When in GAC, it correctly resolves.

Swerve answered 13/11, 2012 at 12:42 Comment(2)
Have you considered overwriting the DLLs and then using a binding redirect in the config file for the entry point(s)?Annamariaannamarie
As I understand redirection would be a mandatory step if we went for option 1. This means we're not only overwriting DLLs that Inventor deployed, but also modifying its configuration file. I don't really like this solution, but it doesn't look like we have another way out. Still, the question remains: is the Enterprise Library backwards compatible enough for such redirections?Swerve
S
4

From what I can see, a reasonable solution would be to embed the assemblies and access them using the ResourceManager class, this would allow you to use the newer versions whilst maintaining the parent projects logging mechanism.

You might find this question useful: Embedding assemblies inside another assembly

Sanorasans answered 14/11, 2012 at 11:2 Comment(1)
Thanks. I didn't know you can do this. It will be useful for future, but I've got a solution for this question already. I'm going to update the post.Swerve

© 2022 - 2024 — McMap. All rights reserved.