@rob_rich

What is this .NET Core thing anyway?

by Rob Richardson

@rob_rich

https://robrich.org/

About Me

Rob Richardson is a software craftsman building web properties in ASP.NET and Node, Angular and React. He's a frequent speaker at conferences, user groups, and community events, and a diligent teacher and student of high quality software development. You can find this and other talks on https://robrich.org/presentations and follow him on twitter at @rob_rich.

.NET Core

.NET Core Features

  • Single compile works cross platform
  • Open source
  • Lighter weight
  • Remove legacy baggage
  • Command-line tools
  • bin-deployable framework
  • Dependency Injection is baked in

.NET Core: didn't make the cut

  • In-memory compiling
  • project.json
  • Write project file yourself
  • Remove web.config
  • Small NuGet packages

All these features are reversed

.NET Standard

.NET Classic

Source: http://andrewlock.net/understanding-net-core-netstandard-and-asp-net-core/

.NET Classic

Source: http://andrewlock.net/understanding-net-core-netstandard-and-asp-net-core/

Portable Class Libraries

Source: http://andrewlock.net/understanding-net-core-netstandard-and-asp-net-core/

Portable Class Libraries

Each runtime is a fork

I must pre-select the runtimes I want

New runtime? I must recompile

.NET Standard

Source: http://andrewlock.net/understanding-net-core-netstandard-and-asp-net-core/

.NET Standard API Surface

.NET Standard (to scale)

.NET Standard 1.6 cheated

Each version is Superset

NuGet provides other things

.NET Standard

.NET Standard
1.0 1.1 1.2 1.3 1.4 1.5 1.6 2.0
.NET Core 1.0 1.0 1.0 1.0 1.0 1.0 1.0 2.0
.NET Framework 4.5 4.5 4.5.1 4.6 4.6.1 4.6.1 4.6.1 4.6.1
Mono 4.6 4.6 4.6 4.6 4.6 4.6 4.6 5.4
Xamarin.iOS 10.0 10.0 10.0 10.0 10.0 10.0 10.0 10.14
Xamarin.Mac 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.8
Xamarin.Android 7.0 7.0 7.0 7.0 7.0 7.0 7.0 8.0
Universal Windows Platform 10.0 10.0 10.0 10.0 10.0 10.0.16299 10.0.16299 10.0.16299
Windows 8.0 8.0 8.1
Windows Phone 8.1 8.1 8.1
Windows Phone Silverlight 8.0

Sources: http://andrewlock.net/understanding-net-core-netstandard-and-asp-net-core/
https://blogs.msdn.microsoft.com/dotnet/2016/09/26/introducing-net-standard/
https://github.com/dotnet/standard/blob/master/docs/versions.md
APIs: https://github.com/dotnet/corefx/blob/master/Documentation/architecture/net-platform-standard.md

.NET Standard

An evolution of PCL

Identifies a common feature set
for this version of .NET
in all environments

 

Detail: http://andrewlock.net/understanding-net-core-netstandard-and-asp-net-core/

Analogy (pseudocode): https://gist.github.com/davidfowl/8939f305567e1755412d6dc0b8baf1b7

.NET Core App

.NET Standard .NET Core .NET Framework
Abstract API Implementation for
Windows, Mac, and Linux
Implementation for Windows

  
    netstandard2.0
  

  
    netcoreapp2.0
  

  
    v4.6.1
  

.NET CLI

.NET CLI Demo

ASP.NET Core

Port of MVC onto .NET Standard

All the features you know and love

  • Controllers
  • Razor
  • Action filters
  • Web API
  • SignalR

New ASP.NET Features

  • Super-set of OWIN
  • Self-hosted
    or reverse-proxied from IIS
  • Web API rolled in
  • Tag Helpers
  • Bower and NPM

New ASP.NET Features

Inherited from .NET Core:

  • Cross-platform
  • Nano server
  • Fast startup
  • bin deployable framework

Not ported

  • Web Forms

ASP.NET Core Demo

Entity Framework Core

New Entity Framework Features

  • Much better defaults
  • Supports much more databases
  • ... including non-relational data stores
  • Entity Framework Migrations

Not ported

  • edmx
  • Designer

.NET Core Data

... or bring your own data story through NuGet

.NET Core

Not ported

  • Web Forms
  • GDI+ (System.Drawing)
  • Control libraries?
  • Other dependencies?

Type Forwarding

.NET Core 2.0 depends on .NET Framework 4.x

.NET 4.7 depends on .NET Core 2.0

source: youtube.com/watch?v=vg6nR7hS2lI

Can I move to .NET Core?

  • Do I need cross-platform or nano server?
  • Are my dependencies ported?
  • Am I ok with the pace of bleeding edge?
  • Do I want to go fast?

Can I move to .NET Core?

Dependency checker: icanhasdot.net

Portability Analyzer: https://github.com/Microsoft/dotnet-apiport/blob/master/docs/VSExtension/README.md

Gotchas

Why are there less overloads?

The goal was a very small .net framework, so redundant overloads were removed

Which NuGet package do I load to get ...?

Class / Namespace to NuGet Package search: packagesearch.azurewebsites.net

What else should I worry about?

.NET Rocks 1335 Migrating to .NET Core with Matt Watson