SlideShare a Scribd company logo
ASP.NET Core 2.1 and Angular 5 in
Visual Studio 2017
LAURENT DUVEAU
MARCH 26TH, 2018
ASP.NET Core 2 and Angular 5 in Visual Studio 2017 Ottawa IT Community, march 2018
Laurent Duveau
@LaurentDuveau
Microsoft MVP in Montreal
Founder of the Angular Academy
2-day Angular Classroom Training
99 classes in 2 years
Montreal, Quebec, Toronto, Ottawa ,
Vancouver, Calgary, Winnipeg, London,
Copenhagen, Helsinki…
March 27-28!
ASP.NET Core 2 and Angular 5 in Visual Studio 2017 Ottawa IT Community, march 2018
Stack Overflow Dev Survey 2018
ASP.NET Core 2 and Angular 5 in Visual Studio 2017 Ottawa IT Community, march 2018
Agenda
Overview of ASP.NET Core + Angular in VS2017
Coding an App!
QnA
ASP.NET Core 2 and Angular 5 in Visual Studio 2017 Ottawa IT Community, march 2018
Setup
.NET Core 2.1 Preview (Win, MacOS, and Linux)
◦ .NET Core 2.1 Preview 1 SDK
◦ .NET Core 2.1 Preview 1 Runtime
Visual Studio 2017 Preview
◦ https://www.visualstudio.com/vs/preview/
Angular Item Templates extension
ASP.NET Core 2 and Angular 5 in Visual Studio 2017 Ottawa IT Community, march 2018
Setup
Visual Studio and Visual Studio “Preview” can be installed side-by-side.
=
VS2017 PreviewVS2017
New ASP.NET Core + Angular Project template
ASP.NET CORE 2.0 ASP.NET CORE 2.1 (PREVIEW)
7
Where is my View??
Angular
ASP.NET
MVC
API
Controller
Angular CLI
Project!
ASP.NET Core 2 and Angular 5 in Visual Studio 2017 Ottawa IT Community, march 2018
New ASP.NET Core + Angular Project template
We get the best of both worlds!
◦ ASP.NET Core project: act as an API backend (data access, authorization, …)
◦ Regular Angular CLI project (ClientApp folder): act as a UI web app
The template offers the convenience of hosting both project
types in a single Visual Studio project, that can be built and
published as a single unit.
ASP.NET Core 2 and Angular 5 in Visual Studio 2017 Ottawa IT Community, march 2018
Architecture
ASP.NET Core
Web API (RESTFUL)
Server side
Client side
Database
HTML
+ Js
ASP.NET Core 2 and Angular 5 in Visual Studio 2017 Ottawa IT Community, march 2018
New Project template
Angular CLI
◦ Built-in commands: ng serve, ng test, ng lint, …
◦ Easier to follow Angular versions (ng update!)
Webpack middleware integration
◦ In dev, you don’t need to keep rebuilding your client-side application
Hot module replacement
◦ Any file changed is pushed into the browser immediately without
reloading the page
Demo
ASP.NET Core 2 and Angular 5 in Visual Studio 2017 Ottawa IT Community, march 2018
Or just using dotnet cli…
Step 1: Install the templates
Step 2: Create a new Angular App
Step 3: Change Environment variable to “Development”
Step 4: Build the application (restore npm dependencies on the first run…)
Step 5: Finally, run the app
dotnet new --install Microsoft.DotNet.Web.Spa.ProjectTemplates::2.0.0
dotnet new angular
SET ASPNETCORE_Environment=Development
dotnet build
dotnet run
ASP.NET Core 2 and Angular 5 in Visual Studio 2017 Ottawa IT Community, march 2018
Already familiar with Angular CLI?
No need to run ng serve!
By default the ASP.NET Core app deals with serving both server-
side and client-side parts of your app (Internally, it uses ng
serve).
But it can be slow…
Each time you modify your C# code, the ASP.NET Core app
needs to restart, and the Angular CLI server restarts.
ASP.NET Core 2 and Angular 5 in Visual Studio 2017 Ottawa IT Community, march 2018
Run "ng serve" independently!
Startup.cs
◦ Replace:
◦ With:
Now just ng serve in your ClientApp folder!
spa.UseAngularCliServer(npmScript: "start");
spa.UseAngularCliServer("http://localhost:4200");
Demo
Let’s talk about Angular
ASP.NET Core 2 and Angular 5 in Visual Studio 2017 Ottawa IT Community, march 2018
Angular Core Concepts
Components Modules
Dependency
Injection
Language
(TypeScript)
Services Data Binding Decorators Routing
ASP.NET Core 2 and Angular 5 in Visual Studio 2017 Ottawa IT Community, march 2018
Building SPAs with Components
Header Component
Menu
Component
Footer Component
List ComponentGrid Component
ASP.NET Core 2 and Angular 5 in Visual Studio 2017 Ottawa IT Community, march 2018
What is a Component?
ASP.NET Core 2 and Angular 5 in Visual Studio 2017 Ottawa IT Community, march 2018
What is a Component?
A component is a reusable object
Made up of: HTML
Template
Code
(ts class)
ASP.NET Core 2 and Angular 5 in Visual Studio 2017 Ottawa IT Community, march 2018
Map Update
App
DetailsList
ProductsMenu Contact
Your app is a tree of Components
Demo
ASP.NET Core 2 and Angular 5 in Visual Studio 2017 Ottawa IT Community, march 2018
Angular classroom training
Tomorrow in Ottawa!
Get 50% OFF with
promo code OTTUG50
Thank you!

More Related Content

More from Laurent Duveau

More from Laurent Duveau (20)

TypeScript: Angular's Secret Weapon
TypeScript: Angular's Secret WeaponTypeScript: Angular's Secret Weapon
TypeScript: Angular's Secret Weapon
 
Introduction to Angular for .NET Developers
Introduction to Angular for .NET DevelopersIntroduction to Angular for .NET Developers
Introduction to Angular for .NET Developers
 
Introduction to Angular for .NET Developers
Introduction to Angular for .NET DevelopersIntroduction to Angular for .NET Developers
Introduction to Angular for .NET Developers
 
Introduction to Angular with TypeScript for .NET Developers
Introduction to Angular with TypeScript for .NET DevelopersIntroduction to Angular with TypeScript for .NET Developers
Introduction to Angular with TypeScript for .NET Developers
 
Introduction to Angular for .NET Developers
Introduction to Angular for .NET DevelopersIntroduction to Angular for .NET Developers
Introduction to Angular for .NET Developers
 
Introduction à Angular 2
Introduction à Angular 2Introduction à Angular 2
Introduction à Angular 2
 
Angular 2... so can I use it now??
Angular 2... so can I use it now??Angular 2... so can I use it now??
Angular 2... so can I use it now??
 
ngconf 2016 (french)
ngconf 2016 (french)ngconf 2016 (french)
ngconf 2016 (french)
 
Microsoft Edge pour les développeurs web
Microsoft Edge pour les développeurs webMicrosoft Edge pour les développeurs web
Microsoft Edge pour les développeurs web
 
Microsoft Edge pour les développeurs web
Microsoft Edge pour les développeurs webMicrosoft Edge pour les développeurs web
Microsoft Edge pour les développeurs web
 
Introduction to SPAs with AngularJS
Introduction to SPAs with AngularJSIntroduction to SPAs with AngularJS
Introduction to SPAs with AngularJS
 
Xamarin.Forms [french]
Xamarin.Forms [french]Xamarin.Forms [french]
Xamarin.Forms [french]
 
Back from Xamarin Evolve 2014
Back from Xamarin Evolve 2014Back from Xamarin Evolve 2014
Back from Xamarin Evolve 2014
 
Windows App Studio
Windows App StudioWindows App Studio
Windows App Studio
 
Windows 8: Live tiles, badges et notifications toasts [french]
Windows 8: Live tiles, badges et notifications toasts [french]Windows 8: Live tiles, badges et notifications toasts [french]
Windows 8: Live tiles, badges et notifications toasts [french]
 
L'opportunité Windows 8 pour les développeurs
L'opportunité Windows 8 pour les développeursL'opportunité Windows 8 pour les développeurs
L'opportunité Windows 8 pour les développeurs
 
Building apps for WP8 and Win8
Building apps for WP8 and Win8Building apps for WP8 and Win8
Building apps for WP8 and Win8
 
Windows Store apps development
Windows Store apps developmentWindows Store apps development
Windows Store apps development
 
L'opportunité Windows 8: Introduction au Windows Store
L'opportunité Windows 8: Introduction au Windows StoreL'opportunité Windows 8: Introduction au Windows Store
L'opportunité Windows 8: Introduction au Windows Store
 
Introduction au Windows Store
Introduction au Windows StoreIntroduction au Windows Store
Introduction au Windows Store
 

Recently uploaded

Recently uploaded (20)

Introduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG EvaluationIntroduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG Evaluation
 
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutes
 
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?
 
Syngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdf
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
 
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCustom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
 
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeFree and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
 
A Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System StrategyA Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System Strategy
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and Planning
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through Observability
 
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptxWSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
 
ECS 2024 Teams Premium - Pretty Secure
ECS 2024   Teams Premium - Pretty SecureECS 2024   Teams Premium - Pretty Secure
ECS 2024 Teams Premium - Pretty Secure
 
UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2
 

ASP.NET Core 2.1 and Angular 5 in Visual Studio 2017

  • 1. ASP.NET Core 2.1 and Angular 5 in Visual Studio 2017 LAURENT DUVEAU MARCH 26TH, 2018
  • 2. ASP.NET Core 2 and Angular 5 in Visual Studio 2017 Ottawa IT Community, march 2018 Laurent Duveau @LaurentDuveau Microsoft MVP in Montreal Founder of the Angular Academy 2-day Angular Classroom Training 99 classes in 2 years Montreal, Quebec, Toronto, Ottawa , Vancouver, Calgary, Winnipeg, London, Copenhagen, Helsinki… March 27-28!
  • 3. ASP.NET Core 2 and Angular 5 in Visual Studio 2017 Ottawa IT Community, march 2018 Stack Overflow Dev Survey 2018
  • 4. ASP.NET Core 2 and Angular 5 in Visual Studio 2017 Ottawa IT Community, march 2018 Agenda Overview of ASP.NET Core + Angular in VS2017 Coding an App! QnA
  • 5. ASP.NET Core 2 and Angular 5 in Visual Studio 2017 Ottawa IT Community, march 2018 Setup .NET Core 2.1 Preview (Win, MacOS, and Linux) ◦ .NET Core 2.1 Preview 1 SDK ◦ .NET Core 2.1 Preview 1 Runtime Visual Studio 2017 Preview ◦ https://www.visualstudio.com/vs/preview/ Angular Item Templates extension
  • 6. ASP.NET Core 2 and Angular 5 in Visual Studio 2017 Ottawa IT Community, march 2018 Setup Visual Studio and Visual Studio “Preview” can be installed side-by-side. = VS2017 PreviewVS2017
  • 7. New ASP.NET Core + Angular Project template ASP.NET CORE 2.0 ASP.NET CORE 2.1 (PREVIEW) 7 Where is my View?? Angular ASP.NET MVC API Controller Angular CLI Project!
  • 8. ASP.NET Core 2 and Angular 5 in Visual Studio 2017 Ottawa IT Community, march 2018 New ASP.NET Core + Angular Project template We get the best of both worlds! ◦ ASP.NET Core project: act as an API backend (data access, authorization, …) ◦ Regular Angular CLI project (ClientApp folder): act as a UI web app The template offers the convenience of hosting both project types in a single Visual Studio project, that can be built and published as a single unit.
  • 9. ASP.NET Core 2 and Angular 5 in Visual Studio 2017 Ottawa IT Community, march 2018 Architecture ASP.NET Core Web API (RESTFUL) Server side Client side Database HTML + Js
  • 10. ASP.NET Core 2 and Angular 5 in Visual Studio 2017 Ottawa IT Community, march 2018 New Project template Angular CLI ◦ Built-in commands: ng serve, ng test, ng lint, … ◦ Easier to follow Angular versions (ng update!) Webpack middleware integration ◦ In dev, you don’t need to keep rebuilding your client-side application Hot module replacement ◦ Any file changed is pushed into the browser immediately without reloading the page
  • 11. Demo
  • 12. ASP.NET Core 2 and Angular 5 in Visual Studio 2017 Ottawa IT Community, march 2018 Or just using dotnet cli… Step 1: Install the templates Step 2: Create a new Angular App Step 3: Change Environment variable to “Development” Step 4: Build the application (restore npm dependencies on the first run…) Step 5: Finally, run the app dotnet new --install Microsoft.DotNet.Web.Spa.ProjectTemplates::2.0.0 dotnet new angular SET ASPNETCORE_Environment=Development dotnet build dotnet run
  • 13. ASP.NET Core 2 and Angular 5 in Visual Studio 2017 Ottawa IT Community, march 2018 Already familiar with Angular CLI? No need to run ng serve! By default the ASP.NET Core app deals with serving both server- side and client-side parts of your app (Internally, it uses ng serve). But it can be slow… Each time you modify your C# code, the ASP.NET Core app needs to restart, and the Angular CLI server restarts.
  • 14. ASP.NET Core 2 and Angular 5 in Visual Studio 2017 Ottawa IT Community, march 2018 Run "ng serve" independently! Startup.cs ◦ Replace: ◦ With: Now just ng serve in your ClientApp folder! spa.UseAngularCliServer(npmScript: "start"); spa.UseAngularCliServer("http://localhost:4200");
  • 15. Demo
  • 17. ASP.NET Core 2 and Angular 5 in Visual Studio 2017 Ottawa IT Community, march 2018 Angular Core Concepts Components Modules Dependency Injection Language (TypeScript) Services Data Binding Decorators Routing
  • 18. ASP.NET Core 2 and Angular 5 in Visual Studio 2017 Ottawa IT Community, march 2018 Building SPAs with Components Header Component Menu Component Footer Component List ComponentGrid Component
  • 19. ASP.NET Core 2 and Angular 5 in Visual Studio 2017 Ottawa IT Community, march 2018 What is a Component?
  • 20. ASP.NET Core 2 and Angular 5 in Visual Studio 2017 Ottawa IT Community, march 2018 What is a Component? A component is a reusable object Made up of: HTML Template Code (ts class)
  • 21. ASP.NET Core 2 and Angular 5 in Visual Studio 2017 Ottawa IT Community, march 2018 Map Update App DetailsList ProductsMenu Contact Your app is a tree of Components
  • 22. Demo
  • 23. ASP.NET Core 2 and Angular 5 in Visual Studio 2017 Ottawa IT Community, march 2018 Angular classroom training Tomorrow in Ottawa! Get 50% OFF with promo code OTTUG50