How can we use .Net 4.0 dll in .Net 2.0 or 4.0 below version applications RRS feed

  • Question

  • Hi,

    I have an windows application which is developed using .Net 2.0 and a class library(dll) which also developed using .Net 2.0.

    Now my dll is updated to 4.0 and implemented some new features.I want to use the new 4.0 dll in my .Net 2.0 windows application.

    I am using method LoadFrom() to load the assembly and creating the instance.


    When i am loading the 4.0 dll using the above API method i am getting  below error.

    "the assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded".

    Note: My requirement is i don`t want to rebuild my .Net 2.0 application. But i need to use the .Net 4.0 dll in my appltcaion using the above API.

    Please help me on this, How can i do this ?

    Any help can be appreciated.



    • Moved by Weiwei Cai Tuesday, December 22, 2015 8:23 AM not VS IDE issue.
    Monday, December 21, 2015 5:29 AM


All replies

  • Hi Kiran,

    Thank you for posting in MSDN forum.

    .NET 3.5/3.0/2.0(using CLR 2.0) applications cannot directly use libraries targets .NET 4.0(using CLR 4.0). Such assemblies will fail to load in 3.5/3.0/2.0 runtime(CLR 2.0).

    However because of in-proc SxS feature in .NET 4.0, you can use a COM object in your .NET 3.5 app which is implemented in .NET 4.0 and it will load both CLR 2.0 and CLR 4.0 into memory and it will work.

    For more info about in-proc SxS,

    Read the thread here:

    Please refer below related thread for more reference,

    How to use 4.0 dll with 3.5 Project


    If my reply is helpful please mark as Answer or vote as Helpful.

    My blog | Twitter | LinkedIn

    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

    Monday, December 21, 2015 6:46 AM
  • Hi Kamlesh,

    I found the information about the in-proccess side by side excution of .net runtime via managed COM.

    I want to know where the official doucment in MSDN about the in-proccess side by side excution of .net runtime via unmanaged COM.

    Of cource, I know that the .NET 4.5 managed component hosted by C++/CLI component is not working in MFC/.NET 2.0 application and it hosted by MFC/ATL COM component with CLR option is working, but I found no offical information about it.

    Do you have any information ? 

    Tuesday, December 29, 2015 6:12 AM