Suppose there is a PC with Framework 4.5 and there is an application that is written under 4.0.

This application is extensible.

Is it possible the correct operation of such an application, if you slip a DLL into it that will be built under 4.5?

Actually, I faced the fact that the application compiled under 4.0 could work with AngleSharp, which is compiled of 4.5. By car user stood 4.5 freymfork. Didn't it seem to me? I always thought that the younger one could not use the functionality of the older one.

  • If you are given an exhaustive answer, mark it as correct (tick the selected answer). - andreycha

2 answers 2

If your application runs under .NET 4.5, then you can download assemblies compiled under 4.5, and they will work correctly, regardless of whether they use features that were not in .NET 4.0. Because all the code - and your application, and third-party assembly - will work under .NET 4.5.

    The .NET Framework version 4.5 was released in such a way that an upgrade to this version from version 4.0 could be performed simply by replacing all dll files. Moreover, your application will not even notice the substitution - builds 4.5 are defined the same way as builds 4.0
    Try running the following code in an application with different .NET Framework.

    Console.WriteLine(Environment.Version.Major); Console.WriteLine(Environment.Version.Build); 

    For both versions (4.0 and 4.5) the output will be:

     4 30319 

    Regarding your question, the application will work stably, Microsoft guarantees full backward compatibility with version 4.0 for version 4.5, you don't even need to substitute.

    • That is, you can send out methods and classes that are supported by 4.0, and inside the assembly itself, even work with async / await? - iluxa1810
    • "until it meets something completely new, which is not in the .NET Framework 4.0" is incorrect. - andreycha
    • @andreycha You are right, I inattentively read the question, decided that the target PC has the .NET Framework 4.0 installed - Geslot
    • one
      @Geslot automatic full backward compatibility is not guaranteed - msdn.microsoft.com/en-us/library/hh367887(v=vs.110).aspx - there is a behavior that changes after installing 4.5, and some things (like problems with SoapFormatter) the old behavior can not be switched - PashaPash
    • one
      @ iluxa1810 so about that and speech. No CLR 4.5 - assemblies compiled under 4.5 will not work. And no matter under which platform the application itself was built. - andreycha