SlideShare a Scribd company logo
1 of 76
Download to read offline
What is the .NET Standard?
A specification defining a versioned set of APIs that
are guaranteed to be implemented by a .NET platform
If a library targets the standard, it runs on all
supporting platforms
Not the whole story
What APIs are included?
What are the different versions?
What about compatibility with existing frameworks and
libraries?
How does it relate to .NET Core? Portable Class Libraries?
How does it work?
What’s the deal with .NET Standard 2.0?
What are we trying to solve?What are we trying to solve?
History lesson
.NET is multiple frameworks

.NET Framework, .NET Core, Silverlight, Windows Store, Windows Phone, Xbox,

Mono, Xamarin, .NET Compact Framework, .NET Micro Framework, …
Different implementations over time

(15 years…)
API Incompatibilities
So how do we share libraries

across .NET implementations?
.NET Standard
Defines the APIs that all platforms must implement
Libraries target the specification, run on supporting
platforms
Isn’t that just Portable Class Libraries?
WAITWAIT
Isn’t that just Portable Class Libraries?
Portable Class Libraries
Libraries that target “profiles”, not frameworks
Profiles are API subsets

Intersection of targeted frameworks and versions
But, arcane - profile numbers? ¯_(ツ)_/¯
Not scalable - new APIs, versions or frameworks
require new profiles
.NET Standard flips the PCL model
PCLs find common ground between implementations
.NET Standard defines the minimum requirements

of an implementation
Libraries target the standard,

run on supporting platforms
Even NEW platforms
.NET Standard is a specification.NET Standard is a specification
Not a Word document
Binary specification - a set of reference assemblies to
compile against
Versioned NuGet package - NETStandard.Library
New versioned target framework - “netstandard”

netstandard1.x, netstandard2.0
Target frameworks
NuGet has Target Framework Monikers - net46,
netcoreapp1.0, win8, etc.
Depend on NuGet package, but target a version of a
framework (net46, net35, net20)

TFM decides what is referenced
Target framework specified in project settings
Target framework as
“platform”
.NET Framework and .NET Core are concrete platforms

Apps run on these platforms
.NET Standard is an abstract platform

Cannot run code on .NET Standard
Libraries target:
netstandard as an abstract platform

Run on any supporting concrete platform
Concrete platforms

Superset of .NET Standard, with platform specific APIs
Apps target:
Concrete platforms

Implements the abstract platform
VersioningVersioning
Versioning is additive
.NET Standard only adds APIs
No process for removing APIs
Adds assemblies, types and type members
2.0
1.6
1.5
1.4
1.3
1.2
1.1
New versions are supersets of
all previous versions
Newer platforms can
consume libraries targeting
older standard versions
1.0
How did we get so many versions so quickly?How did we get so many versions so quickly?
WAITWAIT
.NET Standard introduced with .NET Core 1.0
Back ported to earlier platforms for compatibility
What version of .NET
Standard should I use?
A higher version will have more APIs
A lower version will have more platforms
Target the lowest version you can
API availability
github:dotnet/standard - docs/versions.md
apiport/portability analyser
How do APIs get added?
Review board - .NET Team, Xamarin and Unity

Platform implementers
Not everything will be added to standard
Out of band packages

Pure IL, based on .NET Standard
Criteria - ubiquitous, mature, runtime specific (SIMD)
Packaging the standardPackaging the standard
NETStandard.Library package
v1.5, v1.6, v1.6.1 - package version, not standard
version!
New TFMs - netstandard1.x, netstandard2.x
Target framework decides what version of reference
assemblies are referenced
Demo
NuGet Package Explorer
Package version vs TFM version
Meta-package - all in the dependencies
1.x - fine grained package dependencies
What about

.NET Standard 2.0?
What about

.NET Standard 2.0?
Work in progress - shipping with VS2017
Loads more APIs
Consolidating reference assemblies

netstandard.dll
Consolidating packages

No dependencies for NETStandard.Library
SAME GOALSSAME GOALS
“100% source and binary compatibility for
classic .NET Framework and Xamarin assemblies
and existing PCLs"
–dotnet/standard/docs/netstandard-20/README.md
What was wrong with 1.x?
Not enough libraries targeting .NET Standard or PCLs
Majority of NuGet packages target .NET Framework
Tightly coupled to .NET Core
Cannot evolve .NET Core separately
Not enough APIs - “API cleanup went a bit overboard”
Adding missing APIs
Porting applications to .NET Core was too hard
Intersection of .NET Framework and Mono/Xamarin
Platform specific APIs?
Most excluded
Some APIs included: emulate or throw at runtime
netstandard.dll
Single reference assembly
Contains ALL APIs
The specification is monolithic, why are the reference
assemblies fine grained?
Implications on packaging, implementation and
backwards compatibility
Split with .NET Core
Previously built from .NET Core source
Now has own repo - dotnet/standard
.NET Core implements standard

No longer “special”
Deprecating fine grained packages

Implications for deployment
How does it work?How does it work?
Reference assemblies
Type forwarding
Reference assemblies
Passed to compiler to define available APIs

Compiler error if API is missing
Compiler not interested in implementation
Reference assemblies use empty types

Empty methods, return null/default(T)
Implementation assemblies
Resolved at runtime
Contains the actual implementation
Must contain AT LEAST referenced types and members

Can contain more APIs
Assemblies in the Microsoft.NET folder are
implementation assemblies
Visual Studio uses reference assemblies to target 4.0,
4.5, 4.6.1, 4.6.2, etc.

E.g. C:Program FilesReference AssembliesMicrosoftFramework.NETFrameworkv4.5.2
.NET Standard uses reference assemblies in NuGet
package(s)
Assembly qualified names
Compiler embeds type reference as assembly qualified
name

E.g. System.Threading!System.Threading.Timer
Runtime uses assembly name to resolve type
How to deal with platform implementation differences?

E.g. mscorlib!System.Object, System.Runtime!System.Object
Type forwarding
Assembly attribute redirecting type implementation to
another assembly

[assembly: TypeForwardedTo(typeof(MyNamespace.MyType))]
Cannot rename, only redirect

Must be in same namespace
Redirects at runtime
Also redirects at compile time
Type forwarding
Allows referencing type in one assembly

But implementing in another
Useful for platform differences, or refactoring the
platform
.NET Standard
API is defined in reference assemblies included in
NuGet package
1.x libraries will reference types in System.*.dll
Each platform can type forward to implementation
What can reference what?
.NET Standard 1.x
References embedded
as System.*.dll
Compile time (library)
References embedded
as System.*.dll
no compile errors
Compile time (library)
References embedded
as System.*.dll 

no compile errors
Compile time (library)
Possibly more APIs than .NET Standard 1.x
Microsoft.NETCore.Portable.Compatibility

package adds reference assemblies
NuGet understands
mapping between
platform and net
standard, e.g. net46
and netstandard1.3
Compile time (app)
Everything references
System.*.dll



no compile errors
Compile time (app)
Platform includes
System.*.dll reference
assemblies. Forward to
mscorlib.dll



No compile errors
Compile time (app)
.NET Core
implementation
assemblies match .NET
Standard references
Run time
Runtime assemblies
type forward .NET
Standard System.*.dll
references to real
implementation
Run time
.NET Standard 2.0
Types referenced as
netstandard.dll
Compile time (library)
For 2.0, references
match (netstandard.dll)
No compile errors
Compile time (library)
For 1.x, types
embedded as
System.*.dll
Compile time (library)
NETStandard.Library includes System.*.dll facades that
type forward to netstandard.dll - no compile errors
System.*.dll
references forwarded
to netstandard.dll
Additional package no longer necessary as types added back
Compile time (library)
References embedded
as mscorlib.dll
NETStandard.Library includes mscorlib.dll facade that
type forwards to netstandard.dll - no compile errors
Compile time (library)
References are to
netstandard.dll - no
compile error
Compile time (app)
Transient references to
mscorlib.dll
Compile time (app)
NETCoreApp package includes NETStandard.Library

mscorlib.dll facade forwards to netstandard.dll

- no compile errors
netstandard.dll
references forward to
mscorlib.dll!
Compile time (app)
Transient mscorlib.dll
and System.*.dll
references provided by
platform
Compile time (app)
Runtime
netstandard.dll
forwards to
implementation
Run time
.NET Core 2.0 includes own netstandard.dll

type forwards to real implementation
Requires
netstandard.dll to
forward to mscorlib.dll
Run time
.NET Standard 1.x can reference:
.NET Standard 1.x assembly
PCL assembly
.NET Standard 2.0 can reference:
.NET Standard assembly
PCL assembly
.NET Framework assembly
NuGet knows mapping between platforms and .NET
Standard versions
Allows referencing .NET Framework libraries
from .NET Standard platforms
.NET Standard
Specification for available APIs across platforms
Replacement for PCLs
2.0 is adding back APIs, adding compatibility shims
Links
github: dotnet/standard
@terrajobst’s videos on YouTube

http://bit.ly/netstandard_videos
myget: dotnet-core

NETStandard.Library2
@citizenmatt

More Related Content

What's hot

.NET Framework Overview
.NET Framework Overview.NET Framework Overview
.NET Framework Overview
Doncho Minkov
 
DotNet Introduction
DotNet IntroductionDotNet Introduction
DotNet Introduction
Wei Sun
 
Dot Net Fundamentals
Dot Net FundamentalsDot Net Fundamentals
Dot Net Fundamentals
LiquidHub
 
Nakov - .NET Framework Overview - English
Nakov - .NET Framework Overview - EnglishNakov - .NET Framework Overview - English
Nakov - .NET Framework Overview - English
Svetlin Nakov
 
.Net framework
.Net framework.Net framework
.Net framework
Arun Pal
 
Life as an asp.net programmer
Life as an asp.net programmerLife as an asp.net programmer
Life as an asp.net programmer
Arun Prasad
 
Dotnet framework
Dotnet frameworkDotnet framework
Dotnet framework
Nitu Pandey
 
Migrating To Visual Studio 2008 & .Net Framework 3.5
Migrating To Visual Studio 2008 & .Net Framework 3.5Migrating To Visual Studio 2008 & .Net Framework 3.5
Migrating To Visual Studio 2008 & .Net Framework 3.5
Jeff Blankenburg
 

What's hot (20)

.NET Framework Overview
.NET Framework Overview.NET Framework Overview
.NET Framework Overview
 
Dotnet basics
Dotnet basicsDotnet basics
Dotnet basics
 
Introduction to .NET by QuontraSolutions
Introduction to .NET by QuontraSolutionsIntroduction to .NET by QuontraSolutions
Introduction to .NET by QuontraSolutions
 
Introduction to ,NET Framework
Introduction to ,NET FrameworkIntroduction to ,NET Framework
Introduction to ,NET Framework
 
Visual Studio 2010 and .NET Framework 4.0 Overview
Visual Studio 2010 and .NET Framework 4.0 OverviewVisual Studio 2010 and .NET Framework 4.0 Overview
Visual Studio 2010 and .NET Framework 4.0 Overview
 
DotNet Introduction
DotNet IntroductionDotNet Introduction
DotNet Introduction
 
Dot Net Fundamentals
Dot Net FundamentalsDot Net Fundamentals
Dot Net Fundamentals
 
.Net framework
.Net framework.Net framework
.Net framework
 
Nakov - .NET Framework Overview - English
Nakov - .NET Framework Overview - EnglishNakov - .NET Framework Overview - English
Nakov - .NET Framework Overview - English
 
.Net framework
.Net framework.Net framework
.Net framework
 
.Net framework
.Net framework.Net framework
.Net framework
 
Life as an asp.net programmer
Life as an asp.net programmerLife as an asp.net programmer
Life as an asp.net programmer
 
Dotnet framework
Dotnet frameworkDotnet framework
Dotnet framework
 
1.Philosophy of .NET
1.Philosophy of .NET1.Philosophy of .NET
1.Philosophy of .NET
 
.net CLR
.net CLR.net CLR
.net CLR
 
DOT Net overview
DOT Net overviewDOT Net overview
DOT Net overview
 
Introductionto .netframework by Priyanka Pinglikar
Introductionto .netframework by Priyanka PinglikarIntroductionto .netframework by Priyanka Pinglikar
Introductionto .netframework by Priyanka Pinglikar
 
Microsoft .NET Framework
Microsoft .NET FrameworkMicrosoft .NET Framework
Microsoft .NET Framework
 
6.origins genesis of .net technology
6.origins genesis of .net technology6.origins genesis of .net technology
6.origins genesis of .net technology
 
Migrating To Visual Studio 2008 & .Net Framework 3.5
Migrating To Visual Studio 2008 & .Net Framework 3.5Migrating To Visual Studio 2008 & .Net Framework 3.5
Migrating To Visual Studio 2008 & .Net Framework 3.5
 

Viewers also liked

Prepayment Metering System
Prepayment Metering SystemPrepayment Metering System
Prepayment Metering System
kmhasanc
 

Viewers also liked (10)

.Net Standard Libraries and Xamarin
.Net Standard Libraries and Xamarin.Net Standard Libraries and Xamarin
.Net Standard Libraries and Xamarin
 
.NET Standard - Under the Hood
.NET Standard - Under the Hood.NET Standard - Under the Hood
.NET Standard - Under the Hood
 
.NET Standard - Introduction
.NET Standard - Introduction.NET Standard - Introduction
.NET Standard - Introduction
 
Realtime Apps en .NET Core by Carlos Landeras y Manuel Rodrigo Cabello
Realtime Apps en .NET Core by Carlos Landeras y Manuel Rodrigo CabelloRealtime Apps en .NET Core by Carlos Landeras y Manuel Rodrigo Cabello
Realtime Apps en .NET Core by Carlos Landeras y Manuel Rodrigo Cabello
 
Entity Framework Core by Unai Zorrilla
Entity Framework Core by Unai ZorrillaEntity Framework Core by Unai Zorrilla
Entity Framework Core by Unai Zorrilla
 
Microsoft .NET Platform
Microsoft .NET PlatformMicrosoft .NET Platform
Microsoft .NET Platform
 
ASP.NET MVC Core by Eduard Tomàs
ASP.NET MVC Core by Eduard TomàsASP.NET MVC Core by Eduard Tomàs
ASP.NET MVC Core by Eduard Tomàs
 
Prepayment Metering System
Prepayment Metering SystemPrepayment Metering System
Prepayment Metering System
 
Introduction To Dotnet
Introduction To DotnetIntroduction To Dotnet
Introduction To Dotnet
 
Overview of the new .NET Core and .NET Platform Standard
Overview of the new .NET Core and .NET Platform StandardOverview of the new .NET Core and .NET Platform Standard
Overview of the new .NET Core and .NET Platform Standard
 

Similar to The how-dare-you-call-me-an-idiot’s guide to the .NET Standard (NDC London 2017)

Inside .net framework
Inside .net frameworkInside .net framework
Inside .net framework
Faisal Aziz
 
Dot net interview_questions
Dot net interview_questionsDot net interview_questions
Dot net interview_questions
9292929292
 

Similar to The how-dare-you-call-me-an-idiot’s guide to the .NET Standard (NDC London 2017) (20)

.Net Standard 2.0
.Net Standard 2.0.Net Standard 2.0
.Net Standard 2.0
 
.NET Core Blimey! Windows Platform User Group, Manchester
.NET Core Blimey! Windows Platform User Group, Manchester.NET Core Blimey! Windows Platform User Group, Manchester
.NET Core Blimey! Windows Platform User Group, Manchester
 
Introduction to dot net
Introduction to dot netIntroduction to dot net
Introduction to dot net
 
.Net Core Blimey! (16/07/2015)
.Net Core Blimey! (16/07/2015).Net Core Blimey! (16/07/2015)
.Net Core Blimey! (16/07/2015)
 
.NET Core Blimey! (Shropshire Devs Mar 2016)
.NET Core Blimey! (Shropshire Devs Mar 2016).NET Core Blimey! (Shropshire Devs Mar 2016)
.NET Core Blimey! (Shropshire Devs Mar 2016)
 
.NET Core Blimey! (dotnetsheff Jan 2016)
.NET Core Blimey! (dotnetsheff Jan 2016).NET Core Blimey! (dotnetsheff Jan 2016)
.NET Core Blimey! (dotnetsheff Jan 2016)
 
Raffaele Rialdi
Raffaele RialdiRaffaele Rialdi
Raffaele Rialdi
 
ASP.NET vs ASP.NET Core
ASP.NET vs ASP.NET CoreASP.NET vs ASP.NET Core
ASP.NET vs ASP.NET Core
 
.net Core Blimey - Smart Devs UG
.net Core Blimey - Smart Devs UG.net Core Blimey - Smart Devs UG
.net Core Blimey - Smart Devs UG
 
.NET MeetUp Amsterdam 2017 - .NET Standard -- Karel Zikmund
.NET MeetUp Amsterdam 2017 - .NET Standard -- Karel Zikmund.NET MeetUp Amsterdam 2017 - .NET Standard -- Karel Zikmund
.NET MeetUp Amsterdam 2017 - .NET Standard -- Karel Zikmund
 
.NET Core, ASP.NET Core Course, Session 1
.NET Core, ASP.NET Core Course, Session 1.NET Core, ASP.NET Core Course, Session 1
.NET Core, ASP.NET Core Course, Session 1
 
Pottnet Meetup Essen - ASP.Net Core
Pottnet Meetup Essen - ASP.Net CorePottnet Meetup Essen - ASP.Net Core
Pottnet Meetup Essen - ASP.Net Core
 
Pottnet MeetUp Essen - ASP.Net Core
Pottnet MeetUp Essen - ASP.Net CorePottnet MeetUp Essen - ASP.Net Core
Pottnet MeetUp Essen - ASP.Net Core
 
.NET MeetUp Prague 2017 - .NET Standard -- Karel Zikmund
.NET MeetUp Prague 2017 - .NET Standard -- Karel Zikmund.NET MeetUp Prague 2017 - .NET Standard -- Karel Zikmund
.NET MeetUp Prague 2017 - .NET Standard -- Karel Zikmund
 
Future of .NET - .NET on Non Windows Platforms
Future of .NET - .NET on Non Windows PlatformsFuture of .NET - .NET on Non Windows Platforms
Future of .NET - .NET on Non Windows Platforms
 
c#.pptx
c#.pptxc#.pptx
c#.pptx
 
1..Net Framework Architecture-(c#)
1..Net Framework Architecture-(c#)1..Net Framework Architecture-(c#)
1..Net Framework Architecture-(c#)
 
Inside .net framework
Inside .net frameworkInside .net framework
Inside .net framework
 
Dot net interview_questions
Dot net interview_questionsDot net interview_questions
Dot net interview_questions
 
Visual studio
Visual studioVisual studio
Visual studio
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 

The how-dare-you-call-me-an-idiot’s guide to the .NET Standard (NDC London 2017)