INNOVATION 2.0 .NET Core, UWP, NuGet ■ .NET Core ■ .NET Standard ■ UWP ■ NuGet Packages ■ Actual -> .NET Core 3 ■ Future -> .NET Core 5
INNOVATION 2.0
.NET Core, UWP, NuGet
■ .NET Core
■ .NET Standard
■ UWP
■ NuGet Packages
■ Actual -> .NET Core 3
■ Future -> .NET Core 5
2 von 84School of Engineering © K. Rege, ZHAW
.NET how Microsoft sees it
■ .NET Core 2.0■ various tech stacks
■ .NET Core 3.1■ towards
one Standard Library
https://appdevelopermagazine.com/looking-at-the-future-of-.net/
LTS VersionLTS Version
3 von 84School of Engineering © K. Rege, ZHAW
.NET 5 - The Future - A Unified Platform
■ .NET 5 is the next step forward with .NET Core■ Produce a single .NET runtime and framework that can be used everywhere■ Take the best of .NET Core, .NET Framework, Xamarin and Mono.■ Build that product out of a single code-base
■ Open source and community-oriented on GitHub.■ Cross-platform implementation■ Side-by-side installation■ Capable command-line interface (CLI).
v5.0.0-preview. 1;March, 16 2020
v5.0.0-preview. 1;March, 16 2020
5 von 84School 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 23. Sep 2019■ .NET 4.7.2 is supported
■ .NET Standard 2.1 supported.N
ET
1.N
ET
2
6 von 84School 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
7 von 84School of Engineering © K. Rege, ZHAW
What about the UI
■ There is a different UI library on each platform
■ in the .Net Ecosystem no standard one.■ On Windows, we find WPF (Windows Presentation Foundation) and WinForms, also for Core■ On Linux and macOS (and also Windows) we have GtkSharp.
■ Xamarin.Forms (XAML based)■ iOS, Android, UWP and macOS
Core 3.0
8 von 84School of Engineering © K. Rege, ZHAW
… What about the UI
https://docs.microsoft.com/en-us/windows/desktop/choose-your-technology
9 von 84School of Engineering © K. Rege, ZHAW
Class Library Variants (shown in VS 17)
■ Build new Class Library Project ■ .NET Framework■ uses the full .NET 4.x Framework classes
■ .NET Core■ uses the Core Framework classes■ increases API surface area of your library■ only .NET Core Apps are compatible
■ .NET Standard■ runs on any standard compatible framework
■ such as .NET Core, .NET Framework,Mono/Xamarin
■ more Apps that will be compatible■ decreases API surface area compatible to your
library
■ Legacy Portable■ target a specific subset of .NET implementation.■ strongly discourage their use in new application
■ Universal Windows■ target a very UWP specific implem. Subset■ + the number of Apps that will be compatible
■ Native (i.e. WIN32)■ for C++ Libraries only
10 von 84School of Engineering © K. Rege, ZHAW
11 von 84School of Engineering © K. Rege, ZHAW
The .NET Family of .NET Core 3.0
https://entwickler.de/online/windowsdeveloper/wpf-windows-forms-dotnetcore-3-0-579921733.html
12 von 84School of Engineering © K. Rege, ZHAW
Benefits of .NET Core
■ .NET Core (codename .NET vNext)■ first introduced in 2014
■ Open Source
■ The main benefits are:
13 von 84School 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
14 von 84School of Engineering © K. Rege, ZHAW
… Benefit: RyuJIT Compiler
■ New JIT Compiler since 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 84School of Engineering © K. Rege, ZHAW
… Benefit: Designed for Microservices
■ 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■ superseded by AKS
■ 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 84School of Engineering © K. Rege, ZHAW
… Benefit: Hosting Model Freedom
■ Host your App in the Windows Store or as Web App
■ Various Application Models■ .NET Framework: Windows Forms, ASP.NET, and
Windows Presentation Foundation (WPF).
■ .NET Core: Windows Universal Apps and ASP.NET Core
17 von 84School 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 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, COM■ Your app uses a platform that doesn’t support .NET Core.
https://docs.microsoft.com/en-us/dotnet/standard/choosing-core-framework-server
18 von 84School of Engineering © K. Rege, ZHAW
Core HelloWorld
19 von 84School of Engineering © K. Rege, ZHAW
.NET Core 3 Installation
■ Use LTS Version 3.1
■ For enabling Previews: e.g. NET 5.0
VS17 VS19
20 von 84School of Engineering © K. Rege, ZHAW
… further Installation VS 19
21 von 84School of Engineering © K. Rege, ZHAW
Hello World Application with VS 19
■ File > New > Project -> Console App (.NET Core)
https://docs.microsoft.com/en-us/dotnet/core/tutorials/with-visual-studio
22 von 84School 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, eventually
■ And press start
Console.Write("Press any key to continue...");Console.ReadKey(true);
Console.Write("Press any key to continue...");Console.ReadKey(true);
23 von 84School of Engineering © K. Rege, ZHAW
Hello World Application with CLI
■ Simply start a new console and create a new directory, type
■ Generated files Run in Command Line
> 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>netcoreapp3.1</TargetFramework> </PropertyGroup></Project>
> dotnet --list-sdks> dotnet new globaljson --sdk-version 3.1.201
define global.json -> dnet-version to be used when yourun .NET Core CLI command
define global.json -> dnet-version to be used when yourun .NET Core CLI command
> hello.exe> dotnet hello.dll
{ "runtimeOptions": { "tfm": "netcoreapp3.1", "framework": { "name": "Microsoft.NETCore.App", "version": "3.1.3" } }}
hello.runtimeconfig.json
a runtime config file has to be writtena runtime config file has to be written
24 von 84School 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
25 von 84School 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
26 von 84School of Engineering © K. Rege, ZHAW
Not Available for .NET Core 3.1
■ The following technologies are not (yet) available:■ .NET Remoting■ Application Domains■ ASP.NET Dynamic Data■ ASP.NET Web Forms (ASPX)■ ASP.NET Web Services (ASMX)■ Click-once Deployment■ LINQ to SQL■ Windows Communication Foundation (WCF) as Server■ Windows Workflow Foundation (WF)
■ Blog: what should become part of .NET Core
https://github.com/dotnet/corefx/issues?q=is%3Aopen+is%3Aissue+label%3Aport-to-core
27 von 84School of Engineering © K. Rege, ZHAW
.NETStandard
28 von 84School of Engineering © K. Rege, ZHAW
.NET Standard
■ .NET implementations target specific versions of .NET Standard■ an implementation advertises the highest .NET Standard version it supports■ it also supports previous versions.
■ Goals of the .NET Standard:■ Defines uniform set of BCL APIs for all .NET implementations■ Enables developers to produce portable libraries that are usable across .NET implementations.■ Reduces or even eliminates conditional compilation of shared source due to .NET APIs
■ only required for OS specific APIs .
■ Which .NET Standard version to target■ The higher the version, the more APIs are available to you.■ The lower the version, the more platforms implement it.
29 von 84School of Engineering © K. Rege, ZHAW
.NET Standard
■ Each .NET implementation version advertises the highest .NET Standard version
it supports
https://github.com/dotnet/standard/blob/master/docs/versions.md
30 von 84School of Engineering © K. Rege, ZHAW
UWP
31 von 84School of Engineering © K. Rege, ZHAW
The Convergence Journey
32 von 84School of Engineering © K. Rege, ZHAW
One Window Platform
33 von 84School of Engineering © K. Rege, ZHAW
Universal Windows Platform
■ Goals of the Windows UWP Platform
https://docs.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide
34 von 84School 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 rotten".
■ 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.
35 von 84School of Engineering © K. Rege, ZHAW
Universal Windows Platform - Licensing
■ Run and License one Windows on different Platforms
■ unofficially Windows Versions, MS jargon: "stock-keeping unit"
https://www.zdnet.com/article/microsoft-dont-expect-any-windows-10x-devices-this-calendar-year/
Given how many people are working remotely right now,Microsoft prioritizing virtualized environments, enabled bycontainers and/or Windows Virtual Desktop,
Given how many people are working remotely right now,Microsoft prioritizing virtualized environments, enabled bycontainers and/or Windows Virtual Desktop,
https://blogs.technet.microsoft.com/mniehaus/2017/10/03/easily-switch-from-windows-10-enterprise-to-windows-10-education/
36 von 84School of Engineering © K. Rege, ZHAW
Universal Windows Platform
■ A single, guaranteed (same) API Surface
■ The same on all devices
37 von 84School 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/
38 von 84School of Engineering © K. Rege, ZHAW
A (hell) Lot of APIs
39 von 84School of Engineering © K. Rege, ZHAW
Platform Extensions
40 von 84School of Engineering © K. Rege, ZHAW
Test Capabilities at Runtime
41 von 84School 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
42 von 84School 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
43 von 84School 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
44 von 84School 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>
45 von 84School 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}"/>
46 von 84School 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
47 von 84School of Engineering © K. Rege, ZHAW
To Run own UWP Apps locally
■ Switch settings to developer mode (as admin)
48 von 84School of Engineering © K. Rege, ZHAW
NuGetPacka
ges
49 von 84School 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
50 von 84School 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
51 von 84School of Engineering © K. Rege, ZHAW
Consumtion of a NuGet Package
52 von 84School 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
53 von 84School 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>
54 von 84School of Engineering © K. Rege, ZHAW
Consumption of NuGet Package inside Project
■ 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
55 von 84School 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
56 von 84School 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
57 von 84School of Engineering © K. Rege, ZHAW
Creation of aNuGet Package
58 von 84School of Engineering © K. Rege, ZHAW
Create a package using VS
■ 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
59 von 84School of Engineering © K. Rege, ZHAW
… Create a package using VS
■ 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.
60 von 84School 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,
61 von 84School 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
62 von 84School of Engineering © K. Rege, ZHAW
Publish aNuGet Package
63 von 84School 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:
64 von 84School 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.
65 von 84School 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
66 von 84School of Engineering © K. Rege, ZHAW
67 von 84School of Engineering © K. Rege, ZHAW
.NET Core 3.1
■ Supported on VS 2019, VS for Mac and VS Code
■ Limitation■ 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
68 von 84School of Engineering © K. Rege, ZHAW
.NET Core 3.1
■ Also supports for development of Desktop, IoT and AI applications
https://www.youtube.com/watch?v=upVQEUc_KwU
.NET Core3 extensions.NET Core3 extensions
69 von 84School of Engineering © K. Rege, ZHAW
Desktop Improvements
70 von 84School 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/
71 von 84School of Engineering © K. Rege, ZHAW
Upgrade Path
72 von 84School of Engineering © K. Rege, ZHAW
Migrating a WinForm or WPF app to Core
73 von 84School 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
74 von 84School 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>
75 von 84School 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
76 von 84School of Engineering © K. Rege, ZHAW
ASP.NET Core 3.0 Razor Components (Blazer)
77 von 84School of Engineering © K. Rege, ZHAW
Web Assembly
■ .NET Runtime Libraries compiled to WASM
■ Can run "standard" CLR Code
78 von 84School 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
■ MS works on WASM Compiler Backend for C#■ native code performance in browser: http://radar.zhaw.ch/~rege/psp_hs18/Compiler_V2.pdf
79 von 84School of Engineering © K. Rege, ZHAW
Fragen ?
80 von 84School 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.
81 von 84School 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.
82 von 84School of Engineering © K. Rege, ZHAW
NuGet Commands
83 von 84School of Engineering © K. Rege, ZHAW
NuGet Secondary Commands
84 von 84School of Engineering © K. Rege, ZHAW
.nuspec XML File Element
https://www.errlog.io/blogs/2017/12/creating-a-nuget-package