Partager via


Fundamentals to .NET Core 5

 

To understand .NET Core 5 we should be familiar with below terms:

  • DNVM – .NET Version Manager is a command line tool to configure .NET runtime.
  • DNU – .NET Utilities is a command line utility to install and manage library packages.
  • DNX – .NET Execution Environment is a runtime which includes components to run .NET applications for Windows, Mac and Linux. 

.NET Core 5 cool features:

  • .NET Core 5 supports cross-platform development on Windows, Mac and Linux.
  • Ability to host on IIS or self-host in your own process.
  • We do not have any web.config/app.config settings for ASP.NET applications.
  • There is no packages.config.
  • There is no global.asax.
  • We have project.json, which contains your project metadata, project dependencies and which framework you want the build to run.
  • There is no System.Web.DLL.
  • .NET Core 5 is open source and available in GitHub.
  • .NET Core 5 is available entirely as NuGet packages. 

Let’s start with installing DNVM:

Open command prompt in admin mode and run the following:

@powershell -NoProfile -ExecutionPolicy unrestricted -Command "&{$Branch='dev';iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.ps1'))}" 

 

 Once you run the above command then you should be able to run “dnvm list” command, however the output would return no result for now.

  •  DNVM command to install DNX for .NET Core:

            dnvm upgrade -r coreclr

  •  DNVM Command to install DNX for .NET Framework:

            dnvm upgrade -r clr

  • DNVM command to install default DNX:

            dnvm upgrade

            By default, DNVM will install DNX for the full .NET Framework if no runtime is specified.

  • DNVM Command For 64 bit:

            dnvm upgrade -a x64

  • DNVM command to Install DNX for .NET Core:

            dnvm upgrade -a x64 -r coreclr
            dnvm upgrade -a x86 -r coreclr

  • DNVM command to install specific version of DNX:

            dnvm install -a x86 -r coreclr 1.0.0-rc1-final

  • DNVM command to list the DNX versions installed:

            dnvm list

            Example of how it looks

 

 

In above screen shot Active columns shows which version is picked by DNX.

  • DNVM command to change the runtime version to any specific version and architecture:

            dnvm use -a x64 -r coreclr 1.0.0-rc1-final

  • DNVM command to display the named alias:

            dnvm alias <alias>

  • DNVM command to set alias to specific version:

          dnvm alias <alias> -a x64 -r coreclr 1.0.0-rc1-final              

DNU- .NET Utilities

DNU is a part of DNX SDK which manages the required packages to run an application and dependencies by installing and restoring the packages for the respective project files. For simplicity we can say it’s similar to command line package manager in Visual Studio.

 

Project.Json

.NET Core 5 application contains project.json file where DNU reads this file to retrieve the dependencies and configuring the references/dependencies for the project. It also determines the runtime which can execute the project.

Basically DNU reads the project.json, retrieves and installs the relevant packages to build the project. This runtime which is executed by DNX is based on the commands specified in project.json with the selected version of DNX set by DNVM.

 

Using all the above command let’s see how to create a “Hello World” using .NET Core console application without Visual Studio in next article.