net standard - under the hood

5
.NET Standard Under the Hood

Upload: immo-landwerth

Post on 13-Jan-2017

128 views

Category:

Education


0 download

TRANSCRIPT

Page 1: NET Standard - Under the Hood

.NET StandardUnder the Hood

Page 2: NET Standard - Under the Hood

.NET Standard is represented by• The NuGet package NetStandard.Library which contains• The reference assembly netstandard.dll

At build time• .NET Standard bridges references to existing .NET Framework

and PCL assemblies via type forwardingAt runtime• Each platform provides an implementation for netstandard.dll

that type forwards to its implementation

How does .NET Standard work?

Page 3: NET Standard - Under the Hood

What can you reference from .NET Standard?

My Standard Library 2.x

.NET Standard Library

.NET Framework Library

Portable Class Library

.NET FRAMEWORK .NET CORE XAMARIN

Via Portability

Via Compatibility Shim

Legend

Application Type

Is able to reference

Page 4: NET Standard - Under the Hood

EXISTING .NET FRAMEWORK CLASS

LIBRARY

.NET Standard under the hood

TYPEFORWARDING

netstandard!ObjectYOUR .NET

STANDARD-BASED CLASS LIBRARY

.NET FRAMEWORK OR PORTABLE

CLASS LIBRARY

NETSTANDARD.DLL

MSCORLIB.DLL

DIFFERENT TYPE

IDENTITIES (BAD)

mscorlib!Object

MSCORLIB.DLLMSCORLIB.DLLFRAMEWORK ASSEMBLIES

This happens when you build a .NET Standard-based Library

Page 5: NET Standard - Under the Hood

.NET Standard under the hood

TYPEFORWARDING

This happens when you load .NET Standard-based library

YOUR .NET APPLICATION

YOUR .NET STANDARD-BASED

CLASS LIBRARYNETSTANDARD.DLL

FRAMEWORK ASSEMBLIES