INNOVATION 2.0
.NET Core, UWP, NuGet
■ .NET Core
■ .NET Standard
■ UWP
■ NuGet Packages
■ Future -> .NET Core 3
2 von 82School of Engineering © K. Rege, ZHAW
.NET Future how Microsoft sees it
■ Today■ various tech stacks
■ Future■ one Standard Library
https://appdevelopermagazine.com/looking-at-the-future-of-.net/
4 von 82School of Engineering © K. Rege, ZHAW
.NET Framework Evolution
■ The .NET Framework library has evolved
during the years
Mono Project
■ Goal: Run Microsoft .NET applications
cross-platform
■ Better development tools to Linux
developers.
■ Mono can be run on many platforms■ Android, most Linux distributions,■ BSD, macOS, Windows, Solaris, and even
some game consoles such as PlayStation 3, Wii,and Xbox 360.
■ Current status 21. Dec 2018■ .NET 4.7.2 is supported
.NE
T 1
.NE
T 2
5 von 82School of Engineering © K. Rege, ZHAW
Xamarin
■ Xamarin is a Microsoft-owned San Francisco-based software company■ Founded in May 2011 by the engineers that created Mono■ Xamarin library is based on Mono■ Xamarin.Forms using C# and XAML that is multi platform■ Xamarin is a technology that allows to develop native apps for multiple platforms
■ Using a single C# codebase and .Net.■ common code can be shared and reused, allowing to reduce the codebase .
■ Mono and the .Net Framework are not totally compatible to Xamarin
■ Microsoft has defined a cross platform ".Net Standard" (later)
■ but this .Net Standard does not provide a common UI library - yet
6 von 82School of Engineering © K. Rege, ZHAW
What about the UI
■ There is a different UI library on each platform
■ in the .Net Ecosystem and no standard one.■ On Windows, we find WPF (Windows Presentation Foundation) and WinForms,■ On Linux and macOS (and also Windows) we have GtkSharp.
■ Xamarin.Forms (XAML based)■ iOS, Android, UWP and macOS
7 von 82School of Engineering © K. Rege, ZHAW
Class Library Variants VS 17
■ Build new Class Library Project ■ .NET Standard■ runs on any standard compatible framework
■ such as .NET Core, .NET Framework,Mono/Xamarin
■ + the number of Apps that will be compatible■ - API surface area compatible to your library
■ .NET Framework■ uses the full .NET 4.x Framework classes
■ .NET Core■ uses the Core Framework classes■ + increase the API surface area your library■ - only .NET Core Apps are compatible
■ Legacy Portable■ target a very specific subset of .NET implem.■ strongly discourage their use in new application
■ Universal Windows■ target a very UWP specific implem. Subset■ + the number of Apps that will be compatible
8 von 82School of Engineering © K. Rege, ZHAW
9 von 82School of Engineering © K. Rege, ZHAW
.NET Core
■ Is a new cross-platform Implementation of .NET Libraries■ Elimination of windows only features (e.g. Registry, Forms, WPF)
10 von 82School of Engineering © K. Rege, ZHAW
Benefits of .NET Core
■ .NET Core (codename .NET vNext)■ first introduced in 2014
■ Open Source
■ The main benefits are:
11 von 82School of Engineering © K. Rege, ZHAW
… Benefits of .NET Core
■ Compatibility:■ .NET Core: provides a portable subset of the .NET Framework
■ Class Libraries: CoreFX■ smaller footprint than standard libraries
■ Performance and Scalability:■ NET Core: enhance the performance and scalability due to wider platform support
■ Deployment Options:■ .NET Framework: Internet Information Server only■ .NET Core: directly in the cloud or self-host the application by creating own hosting process.■ Framework -Dependent Deployment (FDD)
■ .NET Core SDK has to be installed on machine beforehand■ Self-Contained Deployment (SCD)
■ .NET Core CLR and class library as part of application package
12 von 82School of Engineering © K. Rege, ZHAW
When to Use .NET Core
■ 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 .NET versions per application.
■ Use .NET Framework for your server application when:■ Your app currently uses .NET Framework (recommendation is to extend instead of migrating).■ Your app uses third-party .NET libraries or NuGet packages not available for .NET Core.■ Your app uses .NET technologies that aren't available for .NET Core.
■ e.g. Registry,Win Forms■ Your app uses a platform that doesn’t support .NET Core.
https://docs.microsoft.com/en-us/dotnet/standard/choosing-core-framework-server
13 von 82School of Engineering © K. Rege, ZHAW
.NET Framework vs .NET Core
■ Application Model■ .NET Framework: Windows Forms, ASP.NET, and
Windows Presentation Foundation (WPF).■ .NET Core: ASP.NET Core and Windows Universal Apps.
■ .NET Standard:■ formerly called "Unified BCL"■ .NET Framework: Each version of .NET Framework uses a specific version
■ For instance, .NET Framework 4.6 implemented the .NET Standard Library 1.3■ NET Core 1.0 implements Standard Version 1.6
■ ASP.NET:■ .NET Core: is a complete rewrite of the existing ASP.NET Framework
■ To be highly modular, with a number of best practices built in (e.g. dependency injection).■ No longer is there a web.config or global.asax,■ In their place are startup.cs and project.json (among others).
14 von 82School of Engineering © K. Rege, ZHAW
RyuJIT Compiler
■ New JIT Compiler for version 2.0
■ more efficient native machine code■ is 100% faster than previous version■ generated 30% faster code■ supports X64 and X86 architectures
■ Profile guided optimization■ records information about code execution■ this information is used for optimize code generation
■ Similar to Java's Hotspot approach but separated optimization step
15 von 82School of Engineering © K. Rege, ZHAW
Core Microservices Architecture
■ Azure App Service■ For stateless microservices.
■ -> Fowler GoTo 2014 Talk
■ Based on Docker■ Can be hosted in your own Linux or Windows infrastructure,■ A cloud service such as Azure Container Service.
■ Azure Service Fabric■ for large and complex microservice systems
■ Azure Kubernetes Service (AKS)
https://azure.microsoft.com/en-us/services/kubernetes-service/
https://docs.microsoft.com/en-us/azure/aks/
https://www.youtube.com/watch?v=wgdBVIX9ifA
16 von 82School of Engineering © K. Rege, ZHAW
Core HelloWorld
17 von 82School of Engineering © K. Rege, ZHAW
Hello World Application with VS
■ File > New > Project -> Console App (.NET Core)
https://docs.microsoft.com/en-us/dotnet/core/tutorials/with-visual-studio
18 von 82School of Engineering © K. Rege, ZHAW
… Hello World Application Build and Run
■ Application template automatically defines a class, Program, with a single
method, Main
■ To keep Console Window open add to generated main Method
■ And press start
Console.Write("Press any key to continue...");Console.ReadKey(true);
Console.Write("Press any key to continue...");Console.ReadKey(true);
19 von 82School of Engineering © K. Rege, ZHAW
Hello World Application with CLI
■ Simply start a new console and create a new directory, type
■ Generated files:
> dotnet new console> dotnet runHello World!
using System;
namespace temp { class Program { static void Main(string[] args) { Console.WriteLine("Hello World!"); } }}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>netcoreapp2.1</TargetFramework> </PropertyGroup>
</Project>
20 von 82School of Engineering © K. Rege, ZHAW
… DOTNET CLI commands
■ CLI command structure consists of■ the driver ("dotnet"),■ the command (or "verb"),■ and possibly command arguments and options.
■ Example greate, build and run
https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet?tabs=netcore21
21 von 82School of Engineering © K. Rege, ZHAW
Development Environment
■ Visual Studio■ By Microsoft■ Supported on Windows and Mac:■ Visual Studio provides an Integrated Development Environment (IDE) for Windows and macOS.■ ReSharper from JetBrains
■ Rider■ By JetBrains■ Cross-platform .NET IDE based on the IntelliJ platform and ReSharper.
■ Visual Studio Code■ By Microsoft but Open Source■ Runs on Mac, Linux, and Windows■ Based on Electron based on Chromium and Node.js■ Integration via .NET Core command-line interface (CLI) tools■ i.e. Notepad++ with memory footprint of VS
■ Works with any other Editors Notepad++, Sublime, Emacs, and Vi■ Integration via .NET Core command-line interface (CLI) tools
22 von 82School of Engineering © K. Rege, ZHAW
Not Yet Available for .NET Core 2.2
■ ASP.NET Web Forms applications
■ ASP.NET Web Pages applications
■ WPF and WinForms Applications
■ WCF Services Implementation■ There’s a WCF-Client library to consume WCF services from .NET Core
■ Workflow-related services■ Windows Workflow Foundation (WF), Workflow Services■ ADO.NET Data Services
■ Blog: what should become part of .NET Core
https://github.com/dotnet/corefx/issues?q=is%3Aopen+is%3Aissue+label%3Aport-to-core
23 von 82School of Engineering © K. Rege, ZHAW
.NETStandard
24 von 82School of Engineering © K. Rege, ZHAW
.NET Standard
■ Each .NET implementation version advertises the highest .NET Standard version
it supports
25 von 82School of Engineering © K. Rege, ZHAW
UWP
26 von 82School of Engineering © K. Rege, ZHAW
The Convergence Journey
27 von 82School of Engineering © K. Rege, ZHAW
One Window Platform
28 von 82School of Engineering © K. Rege, ZHAW
Features of UWP Apps
■ Secure:■ UWP apps declare which device resources and data they access.■ The user must authorize that access.
■ Able to use a common API on all devices that run Windows 10.
■ Able to use device specific capabilities and adapt the UI to different devicescreen sizes, resolutions, and DPI.
■ Available from the Microsoft Store■ on all devices■ or only those that you specify that run on Windows 10.
■ Able to be installed and uninstalled■ without risk to the machine or incurring "machine rot".
■ Engaging: use live tiles, push notifications, and user activities that interactwith Windows Timeline and Cortana's Pick Up Where I Left Off
■ Programmable in C#, C++, Visual Basic, and JavaScript. For UI, use XAML,
HTML, or DirectX.
29 von 82School of Engineering © K. Rege, ZHAW
Universal Windows Platform
■ Run and License one Windows on different Platforms
30 von 82School of Engineering © K. Rege, ZHAW
SKU Stock Keeping Unit
■ In the field of inventory management
■ A stock keeping unit is a distinct type of item for sale and licensing
■ The process of changing the installed SKU of Windows,■ e.g between Windows Pro and Windows Enterprise
https://blogs.technet.microsoft.com/mniehaus/2017/10/03/easily-switch-from-windows-10-enterprise-to-windows-10-education/
31 von 82School of Engineering © K. Rege, ZHAW
UWP in the Context
■ UWP in the Context of Microsoft's technology stack
32 von 82School of Engineering © K. Rege, ZHAW
Universal Windows Platform
■ Goals of the Windows UWP Platform
33 von 82School of Engineering © K. Rege, ZHAW
Universal Windows Platform
■ A single, guaranteed (same) API Surface
■ The same on all devices
34 von 82School of Engineering © K. Rege, ZHAW
API Reference for UWP Apps and APIs
■ Common API that you can use to deliver Apps
■ All devices that run Windows 10. https://docs.microsoft.com/en-us/uwp/
35 von 82School of Engineering © K. Rege, ZHAW
A (hell) Lot of APIs
36 von 82School of Engineering © K. Rege, ZHAW
Platform Extensions
37 von 82School of Engineering © K. Rege, ZHAW
Test Capabilities at Runtime
38 von 82School of Engineering © K. Rege, ZHAW
GUI design for UWP
Effective Pixels Size and Scaling
■ System normalize the way UI elements display on the screen
■ Taking account viewing distance and screen density■ The scaling algorithm ensures that a 24 px font on Surface Hub 10 feet away
is just as legible to the user as a 24 px font on 5"
■ UWP scales across a range of devices with scaling plateaus of■ 100%, 125%, 150%, 175%, 200%, 225%, 250%, 300%, 350%, and 400%.
■ However:■ W10 scaling is different than previous OSs to support also smaller mobile devices■ Automatic Scaling may result in blurry fonts and/or icons■ Principle Question: Application or OS Scaling for High DPI■ Older Programs may not be "High DPI" aware resulting in unusable small Icons,Buttons
■ e.g. Adobe see:http://www.danantonielli.com/adobe-app-scaling-on-high-dpi-displays-fix/
https://docs.microsoft.com/en-us/windows/uwp/design/basics/design-and-ui-intro
39 von 82School of Engineering © K. Rege, ZHAW
… GUI design for UWP
Page Layout
■ Most pages follow a common structure to provide consistency
■ users can easily navigate between and within pages of your app.
■ Pages typically contain three types of UI elements:■ Navigation elements help users choose the content they want to display.■ Command elements initiate actions, such as manipulating, saving, or sharing content.■ Content elements display the app's content.
■ The arrangement of the UI elements may differ for e.g. small mobile deviceshttps://docs.microsoft.com/en-us/windows/uwp/design/layout/page-layout
40 von 82School of Engineering © K. Rege, ZHAW
… GUI design for UWP
Adaptive Layouts
■ Different Layouts according physical
dimensions
■ 1. Define so called "snap points" whendifferent layout should be triggered
■ 2. Define the Triggers for these layouts
<Application.Resources> <!-- window width adaptive snap points --> <x:Double x:Key="MinWindowSnapPoint">0</x:Double> <x:Double x:Key="MediumWindowSnapPoint">641</x:Double> <x:Double x:Key="LargeWindowSnapPoint">1008</x:Double></Application.Resources>
<VisualStateManager.VisualStateGroups> <VisualStateGroup> <!-- Small window VisualState --> <VisualState x:Key="SmallWindow"> <!-- Small window trigger --> <VisualState.StateTriggers > <AdaptiveTrigger MinWindowWidth="{StaticResource MinWindowSnapPoint}"/> </VisualState.StateTriggers> </VisualState>
all size 0 .. 640
41 von 82School of Engineering © K. Rege, ZHAW
… GUI design for UWP
■ 3. Define Properties of this Layout by Setters
■ -> see WPF lecture "Styles"
<VisualState x:Key="SmallWindow"> ... <!-- Small window setters --> <VisualState.Setters> <!-- Apply mobile itemtemplate and styles --> <Setter Target="ImageGridView.ItemTemplate" Value="{StaticResource ImageGridView_MobileItemTemplate}" /> <Setter Target="ImageGridView.ItemContainerStyle" Value="{StaticResource ImageGridView_MobileItemContainerStyle}" />
<!-- Adjust the zoom slider to fit small windows--> <Setter Target="ZoomSlider.Minimum" Value="80" /> ... </VisualState.Setters>
42 von 82School of Engineering © K. Rege, ZHAW
… GUI design for UWP
■ Color■ Use color meaningfully■ Color is personal■ indicate interactivity■ Color is cultural■ Color merely as additional criterion 8% are partially color blind (red-green)
■ Typograph■ default font for UWP apps -> Segoe UI
■ Icons■ Use predefined icons when possible■ Segoe MDL2 Assets font or SVG■ no Bitmaps
■ XAML Theme Resources■ define Theme of top level element■ named Color resources with values that
are tailored for the "Light" and "Dark" themes
<Application x:Class="App9.App" .... RequestedTheme="Light"></Application>
<TextBlock Text="Body" Style="{StaticResource BodyTextBlockStyle}"/>
43 von 82School of Engineering © K. Rege, ZHAW
… GUI design for UWP
Common Controls
■ a set that are guaranteed to work well on all Windows-powered devices
https://docs.microsoft.com/en-us/windows/uwp/design/fluent-design-system/index
44 von 82School of Engineering © K. Rege, ZHAW
NuGetPacka
ges
45 von 82School of Engineering © K. Rege, ZHAW
NuGet
■ NuGet, the open source package manager; it's goals are■ Share functionality between projects■ Publish packages■ Improve and automate parts of the development process■ Versioning of packages
■ Tooling■ Visual Studio extension■ Standalone Console Program
■ Server■ Publicly available package servers such as nuget.org .■ Microsoft itself uses NuGet extensively for the provision of important components■ Many Visual Studio project templates include references to NuGet packages,■ even parts of the .NET Framework itself are now shipped that way.■ there are 147,456 packages (25. 3. 2019)
https://entwickler.de/online/paeckchen-packen-mit-nuget-und-tfs-159983.html
46 von 82School of Engineering © K. Rege, ZHAW
NuGet - Installation
■ Installed with VS 2017 in■ C:\Program Files\Unity\Editor\Data\Tools -> Add to Path if CLI used
■ Or get it online (Windows)■ https://www.nuget.org/downloads
■ Other Platforms (Linux/Mac)■ https://docs.microsoft.com/en-us/nuget/tools/nuget-exe-cli-reference
47 von 82School of Engineering © K. Rege, ZHAW
Consumtion of a NuGet Package
48 von 82School of Engineering © K. Rege, ZHAW
Use of NuGet packages
■ The package management is divided
into different areas:
■ Browse:■ All packages that are available for installation are
displayed here.■ Section is divided into different package servers.
■ Installed:■ All packages that are already installed■ Incidentally, the packages can also be uninstalled
in this section.
■ Updates:■ Displays packages that are already installed and
available for updates.
■ Tools -> Options■ other alternative sources such as myget.org■ or your own local sources
49 von 82School of Engineering © K. Rege, ZHAW
… Use of NuGet packages
■ NuGet automatically creates a file named packages.config within the project
or add reference section in project.assets.json file (.NET Core)
■ In the configuration file, NuGet remembers which packages are installed in which
version in the corresponding project
■ The packages are then downloaded from the corresponding server and storedlocally
■ In addition,■ it is possible to manipulate configuration files and insert additional entries■ Another advantage is that dependencies to other packages can be defined
■ when installing a package these dependencies are detected and the corresponding packagesare automatically installed.
<?xml version="1.0" encoding="utf-8"?><packages> <package id="Google.Protobuf" version="3.7.0" targetFramework="net461" /></packages>
50 von 82School of Engineering © K. Rege, ZHAW
Consumption of NuGet Package inside VS 17
■ Package Manager UI■ Solution Explorer, right-click References and
choose Manage NuGet Packages.
■ Choose "nuget.org" as the Package source,select the Browse tab, search for e.g.Newtonsoft.Json, select that package in the list,and select Install:
■ Accept any license prompts.■ i.e. sell your soul to Microsoft
■ If prompted to select a package managementformat, select PackageReference in project file:
https://docs.microsoft.com/en-us/nuget/quickstart/install-and-use-a-package-in-visual-studio
51 von 82School of Engineering © K. Rege, ZHAW
Versioning/Updating of packages
■ Advantages of using NuGet is that the Package Manager comes with a
versioning and updating mechanism.
■ The reference in the project is always set by NuGet to the version specified inthe packages.config
■ The Package Manager displays all packages for which there is a newer version.■ These can be updated accordingly from there.■ The new version of the package is then downloaded to the packages folder and the reference to the
new version is changed.
■ Also dependencies and missing
packages may be added automatically
52 von 82School of Engineering © K. Rege, ZHAW
Package Manager CLI
■ Select the VS Tools > NuGet Package
Manager > Package Manager Console
menu command.
■ Check that the Default project drop-down list shows the project into which
you want to install the package.■ If you have a single project in the solution, it is
already selected.
■ Enter the command Install-Package e.g.
Newtonsoft.Json (see Install-Package).■ Errors typically indicate that the package isn't
compatible with the project's target framework.■ The CLI nuget install command does not modify
project files or the packages.config file■ Entries must be managed manually.
cd \your_project_folder\nuget.exe Install Newtonsoft.Json -Version 12.0.1
a Newtonsoft.Json.12.0.1 directorywill be created with the .nupkg
a Newtonsoft.Json.12.0.1 directorywill be created with the .nupkg
53 von 82School of Engineering © K. Rege, ZHAW
Package Consumption Workflow
■ consuming a package follows the general workflow.
■ The NuGet CLI■ rem: install command does not modify project files or the packages.config file■ entries must be added manually to project
54 von 82School of Engineering © K. Rege, ZHAW
Creation of aNuGet Package
55 von 82School of Engineering © K. Rege, ZHAW
Create a package using VS 17
■ Create a class library project
■ Configure package properties■ Project > Properties menu command, then select the Package tab■ Give your package a unique identifier and fill out any other desired properties.■ For a description of the different properties, see .nuspec file reference. All of the properties here go
into the .nuspec manifest that Visual Studio creates for the project.
https://docs.microsoft.com/en-us/nuget/quickstart/create-and-publish-a-package-using-visual-studio
56 von 82School of Engineering © K. Rege, ZHAW
… Create a package using VS 17
■ Set the configuration to Release.
■ Right click the project in Solution Explorer and select the Pack command:
■ Visual Studio builds the project and creates the .nupkg file.
57 von 82School of Engineering © K. Rege, ZHAW
Create a package using CLI
■ Creating a .nuspec Filein your project folder
■ add Picture is worth a thousand pull requests
■ Including a README.MD file
■ build your NuGet package
<?xml version="1.0"?><package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd"> <metadata> <id>errlog.io</id> <version>1.1.18</version> … …
cd \your_project_folder\nuget.exe config -Set repositoryPath="\full-path-to-your-packages-folder\"nuget.exe pack -IncludeReferencedProjects -properties Configuration=Release
If your library uses anypackages,
If your library uses anypackages,
58 von 82School of Engineering © K. Rege, ZHAW
…. Create a package using CLI
■ .Nuspec Example
https://www.wiliam.com.au/wiliam-blog/creating-a-nuget-package
<?xml version="1.0"?><package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd"> <metadata> <id>errlog.io</id> <version>1.1.18</version> <title>ErrLog.IO Error and Exception Logging Tool</title> <authors>Matthew Proctor, Michael Sanders, Alastair Bateman</authors> <owners>kutamo</owners> <licenseUrl>https://errlog.io/terms</licenseUrl> <projectUrl>https://errlog.io/docs/getting-started</projectUrl> <iconUrl>https://www.errlog.io/images/errlog_dark_logo.png</iconUrl> <requireLicenseAcceptance>false</requireLicenseAcceptance> <description>ErrLog.IO is an exception and error logging tool</description> <releaseNotes>Bug fixes and performance improvements </releaseNotes> <copyright>Copyright 2017 Kutamo Pty. Ltd.</copyright> <tags>exceptions web http error logging</tags> <dependencies> <dependency id="Newtonsoft.Json" version="10.0" /> </dependencies> <summary>ErrLog.IO is an exception and error logging tool.</summary> </metadata> <files> <file src="readme.md" target="" /> </files></package>
https://www.errlog.io/blogs/2017/12/creating-a-nuget-package
step by step tutorialsstep by step tutorials
59 von 82School of Engineering © K. Rege, ZHAW
Publish aNuGet Package
60 von 82School of Engineering © K. Rege, ZHAW
Acquire your API key
■ Goto: https://www.nuget.org/■ Sign in or create an account if you don't have one already.
■ Acquire your API key■ Select your user name (on the upper right), then select API Keys.■ Select Create, provide a name for your key, select Select Scopes > Push. Under API Key, enter *
for Glob pattern, then select Create. (See below for more about scopes.)■ Once the key is created, select Copy to retrieve the access key you need e.g. in the CLI:
61 von 82School of Engineering © K. Rege, ZHAW
Publish your Package via HTML Page
■ Uploading a Package via Web Upload■ You can simply upload your .nupkg file to via■ https://www.nuget.org/packages/manage/upload
■ Nuget will open your package, read the .nuspec file,and publish your package all in a single step.
62 von 82School of Engineering © K. Rege, ZHAW
… Publish your Package via HTML Page
■ Uploading a Package Manually■ You can simply upload your .nupkg file to nuget by visiting
https://www.nuget.org/packages/manage/upload
■ Nuget will open your package, read the .nuspec file, and publish your package
63 von 82School of Engineering © K. Rege, ZHAW
Publish your Package via CLI
■ nuget.exe has the ability of uploading your package automatically - this means
you can write a script to automatically build and deploy your package simply andwithout interaction.
■ In order to upload your package via nuget.exe, we need to set the API key. You
can create an API key from within your account on Nuget.Org.
■ Once you've set the API Key, you can push your package
■ This can/should be automated with Powershell in the build process
nuget.exe config setApiKey aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeeenuget.exe push [your-package-filename].nupkg -Source https://www.nuget.org/api/v2/package
64 von 82School of Engineering © K. Rege, ZHAW
65 von 82School of Engineering © K. Rege, ZHAW
.NET Core 3 Preview 2 (31.1.2019)
■ Supported on VS 2019, VS for Mac and VS Code
■ Limitation in Preview 2■ Visual Designer for WinForms and WPF are not available
■ but there are workarounds■ WinForms and WPF projects need to be created from CLI
■ dotnet new winforms and dotnet new wpf can be opened by vs 2019 afterwards
66 von 82School of Engineering © K. Rege, ZHAW
.NET Core 3
■ Also supports for development of Desktop, IoT and AI applications
https://www.youtube.com/watch?v=upVQEUc_KwU
.NET Core3 extensions.NET Core3 extensions
67 von 82School of Engineering © K. Rege, ZHAW
Desktop Improvements
68 von 82School of Engineering © K. Rege, ZHAW
Why Windows Desktop on .NET Core
■ Deployment Flexibility■ Side-by-side support■ Machine global or app local framework■ self-contained EXEs
■ Side-by-side of different Frameworks is better supported
■ Future MS Development is focused to .NET Core■ New features will be added first in .NET Core■ Performance Enhancements
■ The same arguments why you should abandon IE and change to Edge
https://www.wired.com/story/microsoft-edge-browser-chromium-internet-explorer/
69 von 82School of Engineering © K. Rege, ZHAW
Upgrade Path
70 von 82School of Engineering © K. Rege, ZHAW
Migrating a WinForm or WPF app to Core
71 von 82School of Engineering © K. Rege, ZHAW
Migrating a WinForm or WPF App to Core
■ Replace Project File with the following
■ If Missing Assemblies, e.g. Registry
■ Add Windows.Compatibility
■ Optionally: add Analyser Package to inspect project
72 von 82School of Engineering © K. Rege, ZHAW
… 2nd Option Migrating an App to Core
■ Create New .NET Core Project (preview -> via Command Line)
> dotnet new winforms -o <ProjectFolder>
73 von 82School of Engineering © K. Rege, ZHAW
Introduction to Blazor
■ Runs in all browsers on the real .NET runtime with full support for .NET Standard.
■ Requires no plugins and no code transpilation, only open web standards
■ Native performance with WebAssembly
■ Easily interact with your existing JavaScript codehttps://docs.microsoft.com/en-us/aspnet/core/client-side/spa/blazor/index?view=aspnetcore-3.0
https://www.youtube.com/watch?v=PiJtEZYMxOc
74 von 82School of Engineering © K. Rege, ZHAW
ASP.NET Core 3.0 Razor Components (Blazer)
75 von 82School of Engineering © K. Rege, ZHAW
Web Assembly
■ Mono .NET Runtime compiled to wasm
■ Can run "standard" CLR Code
76 von 82School of Engineering © K. Rege, ZHAW
Razor Components Code
■ Similar Programming Model and L&F of native Forms Apps
■ Currently .NET Code is interpreted -> 10x slower than native
■ Mono Team works on WASM Compiler Backend for C#■ native code performance in browser: http://radar.zhaw.ch/~rege/psp_hs18/Compiler_V2.pdf
77 von 82School of Engineering © K. Rege, ZHAW
Fragen ?
78 von 82School of Engineering © K. Rege, ZHAW
DOTNET CLI commands
■ The following commands can be passed to the dotnet program
add Add a package or reference to a .NET project. build Build a .NET project. build-server Interact with servers started by a build. clean Clean build outputs of a .NET project. help Show command line help. list List project references of a .NET project. migrate Migrate a project.json project to an MSBuild project. msbuild Run Microsoft Build Engine (MSBuild) commands. new Create a new .NET project or file. nuget Provides additional NuGet commands. pack Create a NuGet package. publish Publish a .NET project for deployment. remove Remove a package or reference from a .NET project. restore Restore dependencies specified in a .NET project. run Build and run a .NET project output. sln Modify Visual Studio solution files. store Store the specified assemblies in the runtime package store. test Run unit tests using the test runner specified in a .NET project. tool Install or manage tools that extend the .NET experience. vstest Run Microsoft Test Engine (VSTest) commands.
79 von 82School of Engineering © K. Rege, ZHAW
… DOTNET CLI commands
■ Additional commands from bundled tools:
dev-certs Create and manage development certificates. ef Entity Framework Core command-line tools. sql-cache SQL Server cache command-line tools. user-secrets Manage development user secrets. watch Start a file watcher that runs a command when files change.
80 von 82School of Engineering © K. Rege, ZHAW
NuGet Commands
81 von 82School of Engineering © K. Rege, ZHAW
NuGet Secondary Commands
82 von 82School of Engineering © K. Rege, ZHAW
.nuspec XML File Element
https://www.errlog.io/blogs/2017/12/creating-a-nuget-package