locked
Two different assemblies with the same name but different version in the same project RRS feed

  • Question

  • Hello folks!

    I have two different assemblies with the same name but different version. Can I add and use them in the same wpf project?

    Any advice would be most welcome!

    Wednesday, August 26, 2015 9:15 AM

Answers

All replies

  • My advice:

    This is a bad idea. Why are you doing this?

    .

    You can, but it's a pain. You can manually add references to the two dll and give them different aliases as described here:

    http://stackoverflow.com/questions/22029721/possible-to-reference-two-different-assemblies-with-the-same-name-in-a-project


    • Marked as answer by hokushin Wednesday, August 26, 2015 3:12 PM
    Wednesday, August 26, 2015 9:34 AM
  • Not in XAML. The XAML parser will prevent you from using multiple version of same assembly: http://social.msdn.microsoft.com/Forums/vstudio/en-US/2028960f-9c3b-47d0-b7da-7f84f34b0df0/xaml-namespace-mappings-to-assembly-versions?forum=wpf


    When it comes to C# you could install both versions of the assembly in the Global Assembly Cache (GAC) on all machines where your application needs to run and then reference the assemblies using their strong names. This of course assumes that the assemblies do have strong names, i.e. that they are signed.

    To be able to use two assemblies that contain types with a same name and same namespace, you could use aliases as described here: https://yoursandmyideas.wordpress.com/2011/11/09/how-to-reference-or-use-same-fully-qualified-class-name-from-different-assemblies/

    Hope that helps.

    Please remember to close your threads by marking helpful posts as answer and then start a new thread if you have a new question. Please don't ask several questions in the same thread.

    • Marked as answer by hokushin Wednesday, August 26, 2015 3:12 PM
    Wednesday, August 26, 2015 10:59 AM
  • Thanks a lot for prompt reply. That's so true. It's really a bad idea.


    I've got two windows forms controls. The controls come with different versions of the same library. And the XAML parser prevents from using multiple version of same assembly. I had a luck though. I had a complete source code for both controls. (took some time to find it) Well, then I upgraded the library in one of them and it did the trick.

    Wednesday, August 26, 2015 3:14 PM