Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.

Raffaele Rialdi

Raffaele Rialdi
Vevy Europe
Introduction to .NET Core with VS2017

  • Als Erste(r) kommentieren

  • Gehören Sie zu den Ersten, denen das gefällt!

Raffaele Rialdi

  1. 1. Introduction to .NET Core with Visual Studio 2017 Raffaele Rialdi Senior Software Architect Vevy Europe @raffaeler raffaeler@vevy.com
  2. 2. Who am I? • I am Raffaele Rialdi, Senior Software Architect in Vevy Europe – Italy • I am also consultant in many industries (manufacturing, racing, healthcare, financial, …) • But also Speaker in italian and international conferences, and Trainer as well • And very proud to have been awarded as a Microsoft MVP since 2003 @raffaeler raffaeler@vevy.com github.com/raffaeler
  3. 3. .NET Framework (version 1.0 - 4.62) • 15 years, 1.8 billion installations • Multiple codebases • Desktop, Silverlight • x86 - Windows • Compact Framework • ARM – Windows CE • Micro Framework • ARM • Non-Microsoft .NET • Mono / Xamarin • Linux, iOS, MacOS, … • x86 and ARM .NET Framework Common Language Specification VB C++ C# F# … Common Language Runtime (CLR) Base Class Library (BCL) Ado.net Asp.net Winform WPF ... Multiple BCL codebases .NET Mono & Unity Compact Framewor k Micro Framewor k Silverlig ht .. . The number of APIs is not proportional to the bars
  4. 4. What is NET Core? • Technically a «fork» of the .NET Framework • New runtime (Common Language Runtime – CLR) • New libraries (Base Class Library – BCL) • Changes to make the Cross Platform story work • Scenarios taking advantage from Net Core (currently) are: • ASP.NET Core: new ASP.NET stack, re-written from scratch • Containerized applications / docker - ready • Cloud Applications: Applications and Microservices running on Azure • Universal Windows Platform: Windows Store Apps (cross-device) • Console Application: the best way to start testing Net Core
  5. 5. Cross-Platform = No first-class Operating System • Official daily compilations on GitHub include many OSes • CentOS, Debian, FreeBSD, openSUSE, RedHat, Linux Mint, Ubuntu 14.04 to 16.10, Alpine Linux, … • OSX 10.11 • Windows Occasionally this may happen :)
  6. 6. The Big Picture • Libraries using just CoreFX can be shared across all the Application Models • Runtime Adaptation Layers are specific to a given Platform / CPU • x86, x64, ARM, ... (more CPUs are coming in town) • Modular design for future extensions • New Application Models • New Operating Systems / Platforms • New CLR variants Runtime Adaption Level CoreCLR .NET Native … .NET Standard Library Runtime Adaption Level … … ASP.NET WPF Win Forms ASP.NET CORE UWP OS X iOS Android .NET Framework "Classic" .NET CORE Xamarin / Mono CoreFX
  7. 7. The unified Command Line called "dotnet" • The CLI (Command Line Interface) is back • In the cross-platform world is the common denominator • Nanoservers, IoT devices, etc. are controlled using the command line • Deploy tasks can be automated • Easy to install on a fresh machine • Visual Studio will provide the UI for all the CLI commands • Support "extensions" to add commands • downloaded via dotnet restore
  8. 8. Hands on the DotNet CLI 1. Install the CLI 2. Create an App 3. Write some code 4. Restore packages 5. Run the app mkdir myapp cd myapp dotnet new dotnet restore http://dot.net/ http://dot.net/ Commands: new Initialize .NET projects. restore Restore dependencies specified in the .NET project. build Builds a .NET project. publish Publishes a .NET project for deployment (including the runtime). run Compiles and immediately executes a .NET project. test Runs unit tests using the test runner specified in the project. pack Creates a NuGet package. migrate Migrates a project.json based project to a msbuild based project. clean Clean build output(s). sln Modify solution (SLN) files. Project modification commands: add Add items to the project remove Remove items from the project list List items in the project Advanced Commands: nuget Provides additional NuGet commands. msbuild Runs Microsoft Build Engine (MSBuild). vstest Runs Microsoft Test Execution Command Line Tool. dotnet run ... https://github.com/dotnet/cli
  9. 9. Netstandard • A library specification defining a set of APIs with no implementation • Think to netstandard as it was a huge interface • All NET Frameworks must implement all those APIs • CoreFX is a superset of netstandard • https://github.com/dotnet/corefx • The review board defines the number of netstandard APIs • No platform specific APIs but abstractions to access to the OS services • Only APIs that should be always available • Netstandard avoid the confusion of external libraries • NodeJS suffers from this problem https://github.com/dotnet/standard/
  10. 10. NetStandard versions vs Platforms Framework TFM .NET Standard netstandard 1.0 1.1 1.2 1.3 1.4 1.5 1.6 2.0 .NET Core netcoreapp 1.0 2.0 .NET Framework net 4.5 4.5.1 4.6 4.6.1 4.6.2 vNext 4.6.1 Mono / Xamarin - vNext UWP uap vNext Windows win 8.0 8.1 Windows Phone wpa 8.1 Silverlight wp 8.0 (obsolete frameworks) more APIs more Frameworks Unity Game Framework is going to support netstandard 2.0 Version # of APIs netstandard 1.6 13,501 netstandard 2.0 32,638
  11. 11. API Cross-Reference • A cross-reference with all .NET APIs • Availability of every APIs in the .NET Framework, Mono, Net Core, … • Answers to the question: which framework does support this API? http://apisof.net
  12. 12. Packages • Nuget is the package manager in the .net environment • There is a 1:1:1 relationship among namespace, dll and package • System.Reflection => System.Reflection.dll => Sytem.Reflection.nupkg • Every package may be released "out of band" • No more waiting for the next «.Net Framework Runtime» • A Metapackage is a 'fake' package redirecting to several real packages • It does not contain dlls but just references to other packages
  13. 13. Metapackages • Metapackages makes developer's life easier • They are predefined sets of commonly used packages • The NETStandard.Library Metapackage • It references the libraries that are part of the ".NET Standard Library" • The Microsoft.NETCore.App Metapackage • It references the libraries that are part of the .NET Core distribution • It is a larger set than NETStandard.Library • The Microsoft.NETCore.Portable.Compatibility Metapackage • The compatibility façades enabling PCLs based on mscorlib to run on NetCore
  14. 14. How Projects specify the framework • A NetCore app / library • targets • references Microsoft.NETCore.App • A Netstandard library targets • targets • references NETStandard.Library • Future 2.0 netcore apps • targets • To run on a specific framework version (this may change in the future) <TargetFramework>netcoreapp1.1</TargetFramework> <TargetFramework>netstandard1.4</TargetFramework> <TargetFramework>netcoreapp2.0</TargetFramework> <RuntimeFrameworkVersion>2.0.0-beta-25108-01</RuntimeFrameworkVersion>  Never reference these metapackages in the nuget references
  15. 15. Self-Contained Depolyment (SCD) • Visual Studio 2017 has a "Publish" menu in the solution explorer • Using the CLI: • The RIDs (Runtime Identifiers) must be specified in the csproj • The nuget package Microsoft.NETCore.Platforms contains the all the available RIDs <RuntimeIdentifiers>win8-arm;ubuntu.14.04-arm;ubuntu.16.04-arm</RuntimeIdentifiers> dotnet publish –r ubuntu.14.04-arm –o folder –c Release
  16. 16. Reducing the footprint of the SCD • Replace netcoreapp1.1 with netstandard1.6 • Explicitly reference these base packages <ItemGroup> <PackageReference Include="Microsoft.NETCore.Runtime.CoreCLR" Version="1.0.2" /> <PackageReference Include="Microsoft.NETCore.DotNetHostPolicy" Version="1.0.1" /> </ItemGroup> <TargetFramework>netstandard1.6</TargetFramework> Standard templates Console WebApp Default win10-x64 45.6 MB 55.5 MB Default ubuntu.16.04-x64 52.6 MB 62.6 MB Reduced win10-x64 28.5 MB 47.4 MB Reduced ubuntu.16.04-x64 36.8 MB 55.9 MB
  17. 17. Why adopting Net Core? • It's fast! • https://github.com/aspnet/benchmarks • It small and ready for container and microsevices! • Docker on x86-x64 is already available! • With 2.0 we will have Docker on ARM devices • It's the familiar .NET you already know! • Netstandard libraries can be used across all the frameworks • The upcoming 2.0 version will provide a shim for cross-framework calls
  18. 18. What's next? • ARM support is coming with netcore 2.0 and netstandard 2.0 • Come to the Exhibition Zone to see a demo with a Raspberry PI! • Interoperability with Node.JS • Come to my session tomorrow, April 2nd, 1.30 - 2.10pm • Use your C# libraries from Node.JS
  19. 19. @raffaeler Questions? www.iamraf.net raffaeler@vevy.com Raffaele Rialdi

    Als Erste(r) kommentieren

    Loggen Sie sich ein, um Kommentare anzuzeigen.

Raffaele Rialdi Vevy Europe Introduction to .NET Core with VS2017


Aufrufe insgesamt


Auf Slideshare


Aus Einbettungen


Anzahl der Einbettungen