<<

Demystifying .NET Standard and .NET Core Presented by Steve Ives Demystifying .NET Standard and .NET Core • Wait, isn’t .NET just … .NET?

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

/ • 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, , and macOS

• .NET Standard • A base set of that are common to all .NET implementations .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 .NET Spreads Its Wings • Mono (since 2001) • Cross-platform .NET CLR, Framework, and # ; led by , , (Attachmate), Xamarin, and now 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 Portable Class Libraries • PCLs emerged as new platforms began Windows iOS Android to adopt .NET App App App • Windows Phone • Linux (Mono) Portable Class • Android, iOS, macOS (Xamarin) (Common Code) • 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 .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 .NET Core Characteristics • Cross-platform • Command-line tools • Runs on Windows, Linux, and macOS • All product scenarios can be • Can be ported to other OSs exercised at the command line • Supported OSs, CPUs, & application scenarios will grow over time, from • Compatible with .NET Framework, • Microsoft Xamarin, and Mono • Other organizations • Individuals • Via the .NET Standard

• Flexible deployment • Open source • Deployed with your app • MIT and Apache 2 licenses • Or installed side by side • A .NET Foundation project • User or machine scope • Can be used in containers • Supported by Microsoft Included with .NET Core … Not Much! • Minimal framework libraries • .NET Core runtime • Primitive types, such as bool and int • Type system • Collections such as Generic List and • Assembly loading Generic Dictionary • Garbage collector • Utility types, such as HttpClient & • Native interop FileStream • Other services • Data types such as DataSet and DbSet • App host program • dotnet.exe • SDK tools and language • Launches .NET Core apps • (C# and ) • Selects and hosts the runtime • F# • Provides loading • Launches the app • Also launches SDK tools Where’s All the Cool Stuff? • Beyond the very , 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 .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 .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 .NET Core 2.1 Platform & Chip Support Platforms Chips • Windows Client: 7, 8.1, 10 (1607+) • X64 Windows • Windows Server: 2008 R2 SP1+ • • Linux • macOS: 10.12+ • macOS • RHEL: 6+ • • Fedora: 26+ • Windows • Ubuntu: 14.04+ • ARM32 • Linux (Ubuntu 18.04+, Debian 9+) • Debian: 8+ • SLES: 12+ • openSUSE: 42.3+ • Synergy support is currently Windows only (more later) • Alpine: 3.7+ Developing with .NET Core • IDEs • Visual Studio • 15.8 or later for Synergy .NET Core • Avoid 15.8.2, it was REALLY BAD! • • 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! 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. 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 ” • 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 Current “Flavors” of .NET • Three flavors of .NET .NET Framework .NET Core Xamarin (Mono)

• Each has its own BCL

• Developers must know about and deal with differences and compatibility issues .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 .NET Standard Versioning Rules Additive • .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 decides whether new API should become part of .NET Standard in a later version .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 .NET Standard Versions

• The higher the version, the more APIs are available

• The lower the version, the more platforms implement it 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 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! 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 Choosing the Right Solution .NET Core .NET Standard

• Command line utilities • Class libraries to be shared across • E.g., CodeGen different applications

• Long-running processes running as console apps or services

• Web applications

• Web services • E.g., Harmony Core services .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 For Additional Information

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

.NET https://blogs.msdn.microsoft.com/dotnet Demystifying .NET Standard and .NET Core Who has the first question?