Microsoft recently announced at Build 2019 that the next major version of .NET will unify both .NET Core 3.* and .NET Framework 4.* into a single .NET platform, which the major version number will be 5.
I didn't understand it well, does it mean that using .NET 5 I will be able to add references to libraries written in both version of .NET?
For example, a .NET 5 project referencing 2 assemblies, one that was compiled targeting .NET Core 3 and another compiled targeting .NET Framework 4.5 (in this case, as it references a .NET Framework library, I think it would only be able to run on Windows).
Yes, you can load . NET Framework assemblies into . NET Core 5 and 6.
The answer is no, we cannot use . NET Framework Base Class Library in . NET Core because of compatibility issues. Basically, the libraries which target .
NET 5 and all future versions will always support . NET Standard 2.1 and earlier. The only reason to retarget from . NET Standard to .
Migrating from . NET Core or . NET 5. In Visual Studio, simply right click on your project in Solution Explorer and choose Properties. Under Application > General > Target framework, choose .
.NET 5 will have the same compatilbity layer that .NET Core currently has.
This allows you to reference .NET Framework DLLs with the caveat that the DLL may not load or execute at runtime. If it is a logic library, it may work well. Not so much if it relies on e.g. System.Web
. This is especially useful for 3rd party libraries which you don't have the source code for. You can use the The .NET Portability Analyzer to check for any use of unsupported APIs in such libraries.
That being said, you should try to change your existing .NET Framework libraries to .NET Standard or multi-target to both .NET Framework and .NET Standard.
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