John Darvill
John Darvill

Reputation: 1303

Why can .Net Core Applications use .Net Framework libraries?

Touch confused, so hopefully someone can set me straight.

I understood from answers like this that this shouldn't be possible.

Is it that if I were to use any .Net Framework code not native to .Net Core in the console library, then the app would crash at runtime? If this is the case, could someone provide an example of something that would crash the app?

Upvotes: 2

Views: 234

Answers (1)

Martin Ullrich
Martin Ullrich

Reputation: 100581

This works because .NET Core (actually .NET Standard) has compatibility shims that allow for .NET Framework assemblies to be loaded on supported runtimes as long as they only use the supported Types/Methods ("API").

Also see Compatibility shim used by .NET Standard 2.0 and the documentation links in there for more details on the compatibility layer.

Upvotes: 2

Related Questions