If i have a library which is compiled in .NET 4 and reference it from a .net 4.5 executable which version of the framework will operations defined in the library execute against?
I have a cli app which is built in .net 4.5 and references both .net 4 and .net 4.5 projects and im wondering if both will use the same version of the ADO.net components.
Yes, you can load . NET Framework assemblies into . NET Core 5 and 6.
NET Framework libraries aren't available for use with . NET 5+ (and . NET Core), such as app domains, remoting, and code access security (CAS).
A cross-platform and open-source framework, . NET Core is best when developing applications on any platform. . NET Core is used for cloud applications or refactoring large enterprise applications into microservices. You should use .
NET Standard 2.0. . NET Standard 2.0 is supported by all modern platforms and is the recommended way to support multiple platforms with one target.
They will both run in the same CLR (4.5 in this case).
With .NET <=3.5, you could have cases where multiple versions of the same assembly will be loaded (so, it could happen that ADO.NET will load version 4.0 and also load 4.5 in the same app domain). As far as I know, they either eliminated that with CLR 4.0 (or at least made it happen way less).
Edit: BTW - there's a difference between the CLR (the runtime running your code) and the versions of the assemblies being loaded.
The version of the CLR governs the capabilities of the process - what it can do, which versions of assemblies it can load. For example,, CLR 4.5 can load pretty much all assemblies (1.0 -> 4.5). They will all run under the 4.5 CLR. On top of that, you cannot run two versions of the CLR from the same compat band in the same process. CLR 4.5 and 4.0 both are considered the same compat band, so either one or the other will load. CLR 1.0, 1.1, 2.0, 3.0 and 3.5 are all considered in the same compat band, so only one of them can load. You can, however, load CLR 3.5 and CLR 4.5 at the same time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With