demystifying .net standard and .net core€¦ · other frameworks built on top of .net core •...

27
Demystifying .NET Standard and .NET Core Presented by Steve Ives

Upload: others

Post on 27-May-2020

24 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Demystifying .NET Standard and .NET Core€¦ · Other Frameworks built on top of .NET Core • ASP.NET Core • Windows 10 UWP • Xamarin.Forms (when targeting UWP) • EF Core.NET

Demystifying .NET Standard and .NET CorePresented by Steve Ives

Page 2: Demystifying .NET Standard and .NET Core€¦ · Other Frameworks built on top of .NET Core • ASP.NET Core • Windows 10 UWP • Xamarin.Forms (when targeting UWP) • EF Core.NET

Demystifying .NET Standard and .NET Core• Wait, isn’t .NET just … .NET?

• .NET Framework• Websites, services, desktop apps, and more on Windows

• Xamarin / Mono• A .NET implementation for running apps on all the major mobile

operating systems

• .NET Core• A cross-platform .NET implementation for websites, servers, and

console apps on Windows, Linux, and macOS

• .NET Standard• A base set of APIs that are common to all .NET implementations

Page 3: Demystifying .NET Standard and .NET Core€¦ · Other Frameworks built on top of .NET Core • ASP.NET Core • Windows 10 UWP • Xamarin.Forms (when targeting UWP) • EF Core.NET

.NET Framework• In the beginning (well, since 2000) there was

the .NET Framework• Extensive, powerful, and flexible• Windows only• Bloated and slow compared to present day .NET

alternatives

• Still a GREAT solution for many workloads• Existing applications already in production• Technologies not available in .NET Core

• WinForms, WPF, WWF, etc.• 3rd party libraries/packages not in .NET Core

Page 4: Demystifying .NET Standard and .NET Core€¦ · Other Frameworks built on top of .NET Core • ASP.NET Core • Windows 10 UWP • Xamarin.Forms (when targeting UWP) • EF Core.NET

.NET Spreads Its Wings• Mono (since 2001)

• Cross-platform .NET CLR, Framework, and C# compiler• Open source; led by Ximian, Novell, (Attachmate),

Xamarin, and now Microsoft and the .NET Foundation• Most Linux platforms, BSD, macOS, Solaris, and

Windows

• Xamarin (since 2011)• Continue Mono development (post Attachmate) and

add commercial products / tooling• Android, iOS, watchOS, macOS• Xamarin Studio (Visual Studio for Mac)• Purchased by Microsoft in 2016

Page 5: Demystifying .NET Standard and .NET Core€¦ · Other Frameworks built on top of .NET Core • ASP.NET Core • Windows 10 UWP • Xamarin.Forms (when targeting UWP) • EF Core.NET

Portable Class Libraries• PCLs emerged as new platforms began

to adopt .NET• Windows Phone• Linux (Mono)• Android, iOS, macOS (Xamarin)

• Develop & deploy code in a library that works on multiple platforms

• Each platform has different capabilities

• Lowest common denominator• Selecting more platforms resulted in fewer

available APIs

Portable Class Library (Common Code)

Windows App

iOSApp

Android App

Page 6: Demystifying .NET Standard and .NET Core€¦ · Other Frameworks built on top of .NET Core • ASP.NET Core • Windows 10 UWP • Xamarin.Forms (when targeting UWP) • EF Core.NET

.NET Core• General-purpose development platform maintained

by Microsoft and the .NET community on GitHub• Open source• Cross-platform, supporting Windows, Linux, and macOS• Can be used in device, service, cloud, and embedded/IoT

scenarios

• Performance & scalability• Cost savings; less hardware / VMs required

• Especially useful for micro services & containers

• Significantly smaller footprint and higher performance than .NET Framework

Page 7: Demystifying .NET Standard and .NET Core€¦ · Other Frameworks built on top of .NET Core • ASP.NET Core • Windows 10 UWP • Xamarin.Forms (when targeting UWP) • EF Core.NET

.NET Core Characteristics• Cross-platform

• Runs on Windows, Linux, and macOS• Can be ported to other OSs• Supported OSs, CPUs, & application

scenarios will grow over time, from• Microsoft• Other organizations• Individuals

• Flexible deployment• Deployed with your app• Or installed side by side

• User or machine scope• Can be used in Docker containers

• Command-line tools• All product scenarios can be

exercised at the command line

• Compatible with .NET Framework, Xamarin, and Mono• Via the .NET Standard

• Open source• MIT and Apache 2 licenses• A .NET Foundation project

• Supported by Microsoft

Page 8: Demystifying .NET Standard and .NET Core€¦ · Other Frameworks built on top of .NET Core • ASP.NET Core • Windows 10 UWP • Xamarin.Forms (when targeting UWP) • EF Core.NET

Included with .NET Core … Not Much!• Minimal framework libraries

• Primitive types, such as bool and int• Collections such as Generic List and

Generic Dictionary• Utility types, such as HttpClient &

FileStream• Data types such as DataSet

and DbSet

• SDK tools and language compilers• Roslyn (C# and Visual Basic)• F#

• .NET Core runtime• Type system• Assembly loading• Garbage collector• Native interop• Other basic services

• App host program• dotnet.exe• Launches .NET Core apps

• Selects and hosts the runtime• Provides assembly loading• Launches the app

• Also launches SDK tools

Page 9: Demystifying .NET Standard and .NET Core€¦ · Other Frameworks built on top of .NET Core • ASP.NET Core • Windows 10 UWP • Xamarin.Forms (when targeting UWP) • EF Core.NET

Where’s All the Cool Stuff?• Beyond the very basics, everything is an

add-on• NuGet packages

• Really cool• You only reference what you need• Everything is open source (GitHub)• Less resources used (except disk)• Lighter and faster

• Really frustrating• Knowing what’s out there• Constantly moving target• No central point for documentation

Page 10: Demystifying .NET Standard and .NET Core€¦ · Other Frameworks built on top of .NET Core • ASP.NET Core • Windows 10 UWP • Xamarin.Forms (when targeting UWP) • EF Core.NET

.NET Core Workloads• Out of the box .NET Core includes a single application model

• Console apps• Command line tools• Hosting local services

• Other Frameworks built on top of .NET Core• ASP.NET Core• Windows 10 UWP• Xamarin.Forms (when targeting UWP)• EF Core

Page 11: Demystifying .NET Standard and .NET Core€¦ · Other Frameworks built on top of .NET Core • ASP.NET Core • Windows 10 UWP • Xamarin.Forms (when targeting UWP) • EF Core.NET

.NET Core Version History• Things are moving FAST!

• .NET Core 1.0• June 27, 2016

• .NET Core 1.1 • November 16, 2016

• .NET Core 2.0• August 14, 2017

• .NET Core 2.1• May 30, 2018

• Point releases (2.1.1, 2.1.2, etc.) every 1 to 2 months

Page 12: Demystifying .NET Standard and .NET Core€¦ · Other Frameworks built on top of .NET Core • ASP.NET Core • Windows 10 UWP • Xamarin.Forms (when targeting UWP) • EF Core.NET

.NET Core 2.1 Platform & Chip SupportPlatforms• Windows Client: 7, 8.1, 10 (1607+)• Windows Server: 2008 R2 SP1+• macOS: 10.12+• RHEL: 6+• Fedora: 26+• Ubuntu: 14.04+• Debian: 8+• SLES: 12+• openSUSE: 42.3+• Alpine: 3.7+

Chips• X64

• Windows• Linux• macOS

• X86• Windows

• ARM32• Linux (Ubuntu 18.04+, Debian 9+)

• Synergy support is currently Windows only (more later)

Page 13: Demystifying .NET Standard and .NET Core€¦ · Other Frameworks built on top of .NET Core • ASP.NET Core • Windows 10 UWP • Xamarin.Forms (when targeting UWP) • EF Core.NET

Developing with .NET Core• IDEs

• Visual Studio• 15.8 or later for Synergy .NET Core• Avoid 15.8.2, it was REALLY BAD!

• Visual Studio Code• Windows, Linux, and MacOS

• Visual Studio for Mac• Formerly Xamarin Studio

• Languages• C#• Visual Basic• F#• Synergy .NET

• Everything can be done at the command line!

Page 14: Demystifying .NET Standard and .NET Core€¦ · Other Frameworks built on top of .NET Core • ASP.NET Core • Windows 10 UWP • Xamarin.Forms (when targeting UWP) • EF Core.NET

Deploying .NET Core Apps• .NET Core Framework can be deployed

• Bundled with an app (default)• Per user install• Machine install

• App distribution created using dotnet publish• Exports app binaries and content files• Dependencies (assemblies from NuGet packages)• .NET Core assemblies and runtime

• Zip and deploy to target systems

• Or build an installer as for any other app• InstallShield, WiX, etc.

Page 15: Demystifying .NET Standard and .NET Core€¦ · Other Frameworks built on top of .NET Core • ASP.NET Core • Windows 10 UWP • Xamarin.Forms (when targeting UWP) • EF Core.NET

Hosting .NET Core Apps• Console app

• Command line utilities• Self-hosted services (development, or run as scheduled task)

• Windows service• Permanent production services

• IIS hosting• Web sites or services• Install .NET Core Hosting Bundle• Configure application pool for “No managed code”

• Azure AppService• Specify license server via SYNERGYLICENSESERVER=name_or_ip

• Docker container• Supported by .NET Core, but currently untested with Synergy• Specify license server as above

Page 16: Demystifying .NET Standard and .NET Core€¦ · Other Frameworks built on top of .NET Core • ASP.NET Core • Windows 10 UWP • Xamarin.Forms (when targeting UWP) • EF Core.NET

Current “Flavors” of .NET• Three flavors of .NET

.NET Framework

.NET CoreXamarin (Mono)

• Each has its own BCL

• Developers must know about and deal with differences and compatibility issues

Page 17: Demystifying .NET Standard and .NET Core€¦ · Other Frameworks built on top of .NET Core • ASP.NET Core • Windows 10 UWP • Xamarin.Forms (when targeting UWP) • EF Core.NET

.NET Standard• A set of APIs that ALL .NET

implementations must adhere to

• A contract that any new .NET implementations must implement

• Advantages• Simplified development• Improved code reuse• Better portability• Easier management, etc.

• .NET Standard class libraries will work across all .NET platforms

Page 18: Demystifying .NET Standard and .NET Core€¦ · Other Frameworks built on top of .NET Core • ASP.NET Core • Windows 10 UWP • Xamarin.Forms (when targeting UWP) • EF Core.NET

.NET Standard Versioning RulesAdditive

• .NET Standard versions are logically concentric circles• Higher versions incorporate all APIs from previous versions• No breaking changes allowed between versions

Immutable• Once shipped, .NET Standard versions are frozen

New APIs• First available in a specific implementation (e.g., .NET Core)• .NET Standard review board decides whether new API should

become part of .NET Standard in a later version

Page 19: Demystifying .NET Standard and .NET Core€¦ · Other Frameworks built on top of .NET Core • ASP.NET Core • Windows 10 UWP • Xamarin.Forms (when targeting UWP) • EF Core.NET

.NET Standard vs. Portable Class Libraries

• .NET Standard supersedes PCL• Improves on the PCL experience by curating a standard BCL• Establishes greater uniformity across .NET implementations

Page 20: Demystifying .NET Standard and .NET Core€¦ · Other Frameworks built on top of .NET Core • ASP.NET Core • Windows 10 UWP • Xamarin.Forms (when targeting UWP) • EF Core.NET

.NET Standard Versions• The higher the version,

the more APIs are available

• The lower the version, the more platforms implement it

Page 21: Demystifying .NET Standard and .NET Core€¦ · Other Frameworks built on top of .NET Core • ASP.NET Core • Windows 10 UWP • Xamarin.Forms (when targeting UWP) • EF Core.NET

Synergy Support for .NET Standard• Initial support & project template in 10.3.3e

• Class Library (.NET Standard)

• Official support in 10.3.3f

• Supported anywhere that Synergy PCLs are supported

• Use .NET Standard over PCL if possible• Less platform conditionals• More future-proof• Better performance

Page 22: Demystifying .NET Standard and .NET Core€¦ · Other Frameworks built on top of .NET Core • ASP.NET Core • Windows 10 UWP • Xamarin.Forms (when targeting UWP) • EF Core.NET

Synergy Support for .NET Core• Initial support & project templates in 10.3.3e

• Class Library (.NET Core)• Console App (.NET Core)

• Official support in 10.3.3f

• Deployment currently supported on Windows.

• Linux support possible, but not currently planned• Participate and vote on the Ideas forum• “Support Synergy .NET Core code on Linux”

(9/25/2018)

• Recommendation• If you’re Windows only and can leverage .NET Core for

better performance, do it!

Page 23: Demystifying .NET Standard and .NET Core€¦ · Other Frameworks built on top of .NET Core • ASP.NET Core • Windows 10 UWP • Xamarin.Forms (when targeting UWP) • EF Core.NET

Synergy Licensing with .NET Standard & .NET Core• .NET Standard produces class libraries

• Runs in the context of .NET Framework or .NET Core

• .NET Core Licensing• If Synergy is installed

• License server configured during installation

• If Synergy is not installed• Environment variable SYNERGYLICENSESERVER=dns_name_or_ip• Makes it possible to host Synergy .NET code in “real” cloud services like

Azure App Service

Page 24: Demystifying .NET Standard and .NET Core€¦ · Other Frameworks built on top of .NET Core • ASP.NET Core • Windows 10 UWP • Xamarin.Forms (when targeting UWP) • EF Core.NET

Choosing the Right Solution.NET Core

• Command line utilities• E.g., CodeGen

• Long-running processes running as console apps or services

• Web applications

• Web services• E.g., Harmony Core services

.NET Standard

• Class libraries to be shared across different applications

Page 25: Demystifying .NET Standard and .NET Core€¦ · Other Frameworks built on top of .NET Core • ASP.NET Core • Windows 10 UWP • Xamarin.Forms (when targeting UWP) • EF Core.NET

.NET Core 3 Roadmap

.NET Core 2.2 (Q4 2018)• Main focus is development tooling improvements

.NET Core 3.0 (2019)• Adding Desktop, IoT, and AI workloads

• WinForms & WPF apps (on Windows)• XAML Islands (host UWP in WinForms & WPF apps)• XAML Controls (UWP browser & media controls for WinForms &

WPF)• Utility available to prepare for migration

• Analyze current app binaries• Report APIs supported and unsupported in .NET Core

• .NET Core App Builder utility• Bundle app and .NET core as a single self-contained .exe• Precompiled, fast startup

• Access to all Windows 10 APIs

Page 26: Demystifying .NET Standard and .NET Core€¦ · Other Frameworks built on top of .NET Core • ASP.NET Core • Windows 10 UWP • Xamarin.Forms (when targeting UWP) • EF Core.NET

For Additional Information

.NET Documentationhttps://docs.microsoft.com/en-us/dotnet/welcome

.NET Bloghttps://blogs.msdn.microsoft.com/dotnet

Page 27: Demystifying .NET Standard and .NET Core€¦ · Other Frameworks built on top of .NET Core • ASP.NET Core • Windows 10 UWP • Xamarin.Forms (when targeting UWP) • EF Core.NET

Who has the first question?Demystifying .NET Standard and .NET Core