Slot 01-Introduction To .NET Platform - Visual
Slot 01-Introduction To .NET Platform - Visual
NET Core
Platform and Visual Studio.NET
Objectives
Overview .NET Framework Architecture
Overview .NET Core and .NET
Introduction to Cross-platform application with .NET
Explain why .NET Core and C# Language is selected as develop
application?
Explain meaning "dotnet CLI ”
Explain about NuGet package
Demo create and run C# Console Application on Windows, Mac
and Linux using “dotnet CLI”
11/24/2024 2
Overview .NET Framework
Introduction to .NET Framework
.NET Framework 1.0
Microsoft .NET Framework 1.0 was released Feb
13, 2002 is the original implementation of .NET .NET Framework 1.1
Developed and run-on Windows platform only .NET Framework 2.0
Closed .NET Framework 3.0
It supports ASP.NET Web Forms, WinForms, WCF,
.NET Framework 3.5
Silverlight, WPF, LINQ, ADO.NET Entity Framework,
Parallel LINQ, Task Parallel Library, etc
.NET Framework 4.0
The .NET Framework 4.8 version was released on
.NET Framework 4.5
April 18, 2019
11/24/2024 4
.NET Framework 4.5 Architecture
11/24/2024 5
The .NET Framework Architecture
The two core components of the .NET Framework integral to any
application or service development are:
• Is a backbone of .NET Framework
Com • Performs various functions such as:
mon • Memory management, Code execution
Langu • Error handling, Code safety verification
age • Garbage collection(GC)
Runti
me
(CLR)
11/24/2024 6
Common Language Runtime(CLR)
A common runtime for all .NET languages
Common type system
Common metadata
Intermediate Language (IL) to native code compilers
Memory allocation and garbage collection
Code execution and security
Over 20 languages supported today
C#, VB, Jscript, Visual C++ from Microsoft
Perl, Python, Smalltalk, Cobol, Haskell, Mercury, Eiffel, Oberon, Oz, Pascal, APL,
CAML, Scheme, etc.
11/24/2024 7
Common Language Runtime(CLR)
Using the .NET Framework:
The code of a program is compiled into
CIL (formerly called MSIL) and stored in
a file called assembly
This assembly is then compiled by the
CLR to the native code at run-time
In traditional Windows applications:
Codes were directly compiled into the
executable native code of the operating
system
11/24/2024 8
Advantages of CLR
Interoperation between managed code and unmanaged code (COM,
DLLs)
Managed code environment
Improved memory handling
JIT(Just-In-Time) Compiler allows code to run in a protected
environment as managed code
JIT allows the IL code to be hardware independent
CLR also allows for enforcement of code access security
Verification of type safety
Access to Metadata (enhanced Type Information)
11/24/2024 9
Common Language Infrastructure
11/24/2024 10
Common Language Infrastructure
CLI allows for cross-language development
Four components:
Classes
Structures
Enumerations
Interfaces
Delegates
11/24/2024 13
CTS Data Types
11/24/2024 14
The .NET Framework Architecture
Common Language Specification (CLS)
The CLS comprises a set of rules that any language that targets the CLI needs to
adhere to, to be able to interoperate with other CLS-compliant languages
CLS rules fall into the broader rules of the CTS and therefore it can be said that the
CLS is a subset of CTS
Language constructs that make it impossible to easily verify the type safety of the
code were excluded from the CLS so that all languages that work with the CLS can
produce verifiable code
11/24/2024 15
The .NET Framework Architecture
11/24/2024 17
Cross-Platform Application
A platform is a computer hardware and software combination on which a
program runs. A platform is a combination of both hardware resources: CPU
frequency, RAM size, HDD space, GPU capacity,…and also the software
platform being provided to install on such as Operating system; Third-party or
extended framework(.NET or JVM,..)
Cross-platform support runs on multiple platforms. In a sense, it means that a
code can run on multiple frameworks, platforms, operating systems, and
machine architectures
A cross-platform programming language is one that can run on multiple
frameworks, operating systems, and machine architectures. Many factors cause
the language or tool to be able to run on multiple machines and platforms
11/24/2024 18
Overview .NET Core
What is the .NET Core?
It is a cross-platform, open-source framework that implements .NET Standard
It includes JIT(Just-In-Time) Compiler, GC(Garbage Collection) and several
low-level classes
It provides a runtime known as .NET Core CLR, framework class libraries,
which are primitive libraries known as CoreFX, and APIs that are similar to CLR
and BCL(Base Class Library) of .NET Framework, but have a smaller
footprint (lesser dependencies on other assemblies)
11/24/2024 20
What is the .NET Core?
CoreFX is made of foundation class libraries. These come as alternatives to
CLR and BCL of .NET Framework. It comes integrated with .NET Core CLI
It supports modern application frameworks such as gRPC, ML.NET for
Machine Learning, ASP.NET Core Razor Pages, Blazor (for WebAssembly),
UWP(Universal Windows Platform), etc
The .NET Core 5(.NET) version was released November 10, 2020
11/24/2024 21
.NET 5 (.NET) = .NET Core
vNext
Released on November 10, 2020 (Visual Studio 2019 and C# 9.0)
11/24/2024 22
What is the .NET Standard?
.NET Standard is a specification that can be used across all .NET
implementations. It is used for developing library projects only. This means if
we are creating a library in .NET Standard we can use those in .NET
Framework and .NET Core
To create uniformity means to allow usage in all the .NET
implementations. .NET Standard has support for Mono platform, Xamarin,
Universal Windows Platform, and Unity
11/24/2024 23
Comparisons Table
11/24/2024 24
New features in .NET 5 (.NET)
Java interoperability will be available on all platforms
Objective-C and Swift interoperability will be supported on multiple
operating systems
CoreFX will be extended to support static compilation of .NET (ahead-of-
time – AOT), smaller footprints and support for more operating systems
11/24/2024 25
Benefits of using .NET
Open Source: Open source and community-oriented on GitHub.
Cross-Platform: .NET Core can run on Windows, Linux, and macOS
Command-line tools: Create, build, and run projects from the command line
Modular: Ships as NuGet packages
Host Agnostic:
.NET Core on the server side is not dependent on IIS and, with two lightweight
servers: Kestrel and WebListener
It can be self-hosted as a Console application and can be also gelled with mature
servers such as IIS, Apache, and others through a reverse proxy option
11/24/2024 26
Benefits of using .NET
Support for leveraging platform-specific capabilities, such as Windows Forms
and WPF(Windows Presentation Foundation) on Windows and the native
bindings to each native platform from Xamarin
High performance
Side-by-side installation
Small project files (SDK-style)
Visual Studio, Visual Studio for Mac, and Visual Studio Code integration
11/24/2024 27
.NET components
Language compilers: These turn source code written with languages such as
C#, F#, and Visual Basic into intermediate language (IL) code stored in
assemblies. NET language compilers for C# and Visual Basic, also known as
Roslyn
Common Language Runtime (CoreCLR): This runtime loads assemblies,
compiles the IL code stored in them into native code instructions for computer's
CPU, and executes the code within an environment that manages resources
such as threads and memory
Base Class Libraries (BCLs) of assemblies in NuGet packages (CoreFX):
These are prebuilt assemblies of types packaged and distributed using NuGet
for performing common tasks when building applications
11/24/2024 28
Why C# is selected as develop application?
C# was developed by Anders Hejlsberg and his team during the development
of .NET
C# is a modern, object-oriented, and type-safe programming language. C#
enables developers to build many types of secure and robust applications that
run in the .NET ecosystem. C# has its roots in the C family of languages and
will be immediately familiar to C, C++, Java, and JavaScript programmers
C# is designed for Common Language Infrastructure (CLI), which consists of
the executable code and runtime environment that allows use of various high-
level languages on different computer platforms and architectures
11/24/2024 29
Why C# is selected as develop application?
The following reasons make C# a widely used professional language
It is a modern, general-purpose programming language
It is object oriented.
It is component oriented.
It is easy to learn.
It is a structured language.
It produces efficient programs.
It can be compiled on a variety of computer platforms.
It is a part of .Net
More C# features :
https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/
11/24/2024 30
Introduction to dotnet CLI
The .NET command-line interface(CLI) is a cross-platform for developing,
building, running, and publishing .NET applications
More dotnet CLI:
https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet/
11/24/2024 31
Introduction to dotnet CLI
11/24/2024 32
Introduction to dotnet CLI
11/24/2024 33
Demo Create a C# Console App
using dotnet CLI
On Windows OS
Install package: dotnet-sdk-5.0.102-win-x64.exe and open Command Prompt
dialog
1. Create Console App named HelloWorldApp with C# language
11/24/2024 35
2. Build HelloWorldApp application
11/24/2024 36
On macOS 10.14 "Mojave"
Install package: dotnet-sdk-5.0.102-osx-x64.pkg and open Terminal dialog
11/24/2024 37
On Linux(Ubuntu 14.05) OS
Install package: dotnet-sdk-5.0 and open Terminal dialog
1. Create Console App named HelloWorldApp with C# language
11/24/2024 38
Compilation Process .NET Application
11/24/2024 39
Compilation Process .NET Application
The compiler used by the dotnet CLI tool converts .NET source code(C#/VB/C+
+,..) into Intermediate Language (IL) code, and stores the IL in an assembly
(a DLL or EXE file)
IL code statements are like assembly language instructions, but they are executed
by .NET Core's virtual machine, known as the CoreCLR
At runtime, the CoreCLR loads the IL code from the assembly, JIT compiles it
into native CPU instructions, and then it is executed by the CPU on your
machine
The benefit of this two-step compilation process is that Microsoft can create
CLRs for Linux and macOS as well as for Windows. The same IL code runs
everywhere because of the second compilation process that generates code for
the native operating system and CPU, etc
11/24/2024 40
Common Intermediate Language (CIL)
CIL is a platform-neutral intermediate language (formerly called Microsoft
Intermediate Language or MSIL) that represents the intermediate language
binary instruction set defined by the CLI. It is a stack-based object-oriented
assembly language that represents the code in byte-code format
11/24/2024 41
Introduction to Visual Studio.NET Read by
yourself
Visual Studio is one of the most famous IDE’s has been using for the last few
years. Microsoft developed it. It is used to create a computer program, web
applications, and EXE files, etc. The first version of its kind was launched in
1997. And now the latest version available in the market is Visual Studio 2019
11/24/2024 42
Introduction to Visual Studio.NET Read by
yourself
New User Experienced Start Window: Check out the code, Open a project,
Open a folder and Create a new project
Visual Studio Live Share: Live Share is a developer service in Visual Studio
2019. This feature directly enables to share code context and debugging
process with your teammates and get live access within Visual Studio itself like
Google document services
Improved Refactoring: Refactoring in any IDE will highly helpful for
developers. In Visual Studio 2019 these refactorings will come up with new
advanced features, and these are used to organize your code in a structured
manner
11/24/2024 43
Introduction to Visual Studio.NET
Enhanced Search Experience
Search Feature While in Debugging
Visual Studio IntelliCode
Code cleanup in One Click
Integrated Code Reviews in Development
Per Monitor Aware Rendering(PMA)
New Delivery Model for SQL Server Data Tools
11/24/2024 44
Introduction to Nuget packages
.NET is split into a set of packages, distributed using a Microsoft supported
package management technology named NuGet. Each of these packages
represents a single assembly of the same name
For example, the System.Collections package contains the System.Collections.dll
assembly
11/24/2024 45
Introduction to Nuget packages Read by
yourself
Install and use a package for .NET project in Visual Studio
Using NuGet Package Manager
(For Windows:
https://docs.microsoft.com/en-us/nuget/quickstart/install-and-use-a-package-in-visual-st
udio
)
(For Mac:
https://docs.microsoft.com/en-us/nuget/quickstart/install-and-use-a-package-in-visual-st
udio-mac
)
47