1

Here's the problem: if I compose parts with like this:

        var catalog = new AggregateCatalog();

        /*add DirectoryCatalogs to catalog*/

        CompositionContainer container = new CompositionContainer(catalog);
        container.ComposeParts(this);

and there are two versions of one assembly, then composition contains two parts that reffers to the same library (first one that was added to AggregateCatalog).

Is there a way to compose parts from different versions of the same dll?

keymusicman
  • 1,281
  • 1
  • 10
  • 20
  • AFAIK you can't because you can't load same (not signed) assembly twice where they differ only because of version. – Adriano Repetti Jan 27 '15 at 13:09
  • possible duplicate of [C# Load different versions of assembly to the same project](http://stackoverflow.com/questions/20686362/c-sharp-load-different-versions-of-assembly-to-the-same-project) – Adriano Repetti Jan 27 '15 at 13:13
  • Adriano Repetti, I've found all the answers before posting my question and there were only suggestions with reflection. So, I thought that MEF could use it by other way. As for reflection, this article is very useful [Loading Multiple Versions of same Assembly](http://www.infosysblogs.com/microsoft/2007/04/loading_multiple_versions_of_s.html). But anyway, that's not what I was looking for. Thanks for your answer. – keymusicman Jan 27 '15 at 13:28
  • With Reflection you can inspect assemblies/types but it doesn't change CLS can't load same assembly twice (it doesn't matter if you load them through dependencies, `Type.GetType()` or `Assembly.Load()`). Best solution (in the accepted answer) is...to sign them. Signed assemblies can be loaded _side by side_ with different versions. – Adriano Repetti Jan 27 '15 at 13:32

0 Answers0