Skip to main content
UNBOXING
ASP.NET CORE
Open-source | Modular | Cross-platform
Kevin Leung
 Microsoft Bot Framework
 Cognitive Services + LUIS.ai
 ASP.NETCore
 Internet ofThings
MicrosoftTechnical Evangelist
Follow Me: @KSLHacks
Road Map
 What is ASP.NET Core?
 Architecture Differences
 CoreValues
 Command Line Interface
 Starting a New App
 .NET Core 2.0 Roadmap
ASP.NET in a Nutshell
.NET Framework 4.6 .NET Core 1.0
Full .NET Framework for any scenario and
library support on Windows
Modular libraries & runtime optimized for server
and cloud workloads
High Level Differences
System wide
No Side by Side
(same version)
Patches difficult
(Breaking
changes)
Features slow and
coupled
Full .NET
CLR is 15MB
Target
Frameworks and
Runtimes
Modular Nuget
Packages
Open Source &
Cross Platform
.NET Core
Totally Modular
Open Source with Contributions
Faster Development Cycle
Choose your Editors andTools (VS 2017)
Cross Platform
Fast
OSS
Tech Empower Bencharks
The Command Line
■ CLI works cross-platform fast and reliable
■ Goals in mind:
– Easy to start new project
– Easy to restore
– Easy to run
– Easy to publish app (FDD & SCD)
STARTING A NEW
CORE APP
dotnet new
Build Specific Runtimes (.csproj)
■ Open .csproj
■ Specify <RuntimeIdentifiers>
■ Dotnet restore
■ Specify <OutputType>
■ Dotnet build --runtime win10-x64
■ Dotnet publish --runtime win10-x64 (Self contained app – CLR included)
■ RID-Catalog: https://docs.microsoft.com/en-us/dotnet/articles/core/rid-catalog
Console app to MVC app
Console app to MVC app
■ Some Razor in .cshtml (Views/Home/Index.cshtml)
Startup.cs Middleware Matters!
■ Middleware in Dotnet Core app defines how your web service handles incoming HTTP
requests.
IIS Platform
Middleware
Welcome Page
MVC Routing
Middleware
IIS Platform
Middleware
Developer
Exception Page
Run Middleware
Can I handleThis?
Yes!
Can I do anything?
Exception!
Display
MVCTEMPLATE
WITH AUTH
dotnet new mvc –auth Individual
Creating .sln using the CLI
■ Create the dotnet core project in your directory.
– ‘dotnet new mvc’
■ Create a new solution file in the directory (will default to dir name)
– ‘dotnet new sln –n <soluton name>
■ Add the .csproj file into the .sln
– ‘dotnet sln <project>.sln add <project>.csproj
■ Able to open up inVisual Studio IDE
Dependency Injection
■ Provide a way for objects and classes to be passed dependencies
– Constructor Injection is commonly seen
■ Framework services injected into Startup Class
– As well as application services..
■ Dependency Injection intoViews
Tag Helpers
■ Enable server-side code to render elements in Razor files
■ Form tag helpers provide a robust way to facilitate the post back data
– Can generate a hidden Request VerificationToken
■ Input tag helpers with attributes
– Enforce certain input types through viewmodels
■ Cleaner and easier to read, edit and maintain.
Tag Helpers
Decisions Decisions..
You should use .NET Framework for your
server application when:
■ Your application currently uses .NET
Framework (recommendation is to extend
instead of migrating)
■ You need to use third-party .NET libraries
or NuGet packages not available for .NET
Core.
■ You need to use .NET technologies that are
not available for .NET Core.
■ You need to use a platform that doesn’t
support .NETCore.
You should use .NET Core for your server
application when:
■ You have cross-platform needs.
■ You are targeting microservices.
■ You are using Docker containers.
■ You need high performance and
scalable systems.
■ You need side by side of .NET versions
by application.
ASP.NET CORE 2.0
Roadmap looking forward
Primary .NET Core 2.0Theme
■ Lower the Barrier of Entry and Reach
– Standardize shared API across .NET Framework, .NETCore and Xamarin
– Easier to share code and reference tooling
■ .NET CoreTooling
– Tooling for different .NETCore versions targeted
– Changing existing project’s target runtimes
– Full .csproj package IntelliSense
■ Performance
■ .NET Core and Cloud
■ Build from source
■ 2.0 Preview Release Notes
Thanks!
■ Get .NET Core  Dot.net
■ Get Involved  Github.com/aspnet
■ Portability Analyzer  Github.com/Microsoft/dotnet-apiport
■ docs.microsoft.com/aspnet/core/
// Kevin Leung
// MicrosoftTechnical Evangelist
//Twitter: @KSLHacks (send questions here)
// Github: KSLHacks