Skip to content
Search

Dotnet

lastmod 2023-04-10created 2020-11-1212 edits

The generic driver for the .NET Core CLI.

Category

How to install

If it is already installed, use the

dotnet --list-sdks

and

dotnet --list-runtimes

commands to check the installed versions.

ArchLinux

If you only want to run .NET Core managed applications, install the dotnet-runtime package.

To build apps with .NET Core, install dotnet-sdk as well.

Microsoft recommends using Visual Studio Code, their Electron-based FOSS IDE, to build & debug .NET Core apps.

NOTE

Add ~/.dotnet/tools to PATH, otherwise dotnet tools will not work from shell.

Ubuntu

Ubuntu 20.04

Add the Microsoft package repository

Installing with APT can be done with a few commands. Before you install .NET, run the following commands to add the Microsoft package signing key to your list of trusted keys and add the package repository.

Open a terminal and run the following commands.

wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
Install the SDK

The .NET SDK allows you to develop apps with .NET. If you install the .NET SDK, you don't need to install the corresponding runtime. To install the .NET SDK, run the following commands.

sudo apt-get update
sudo apt-get install -y dotnet-sdk-7.0
Install the runtime

The ASP.NET Core Runtime allows you to run apps that were made with .NET that didn't provide the runtime. The following commands install the ASP.NET Core Runtime, which is the most compatible runtime for .NET. In your terminal, run the following commands.

sudo apt-get update
sudo apt-get install -y aspnetcore-runtime-7.0
Install the .NET runtime without ASP.NET Core support

As an alternative to the ASP.NET Core Runtime, you can install the .NET Runtime, which doesn't include ASP.NET Core support.

Replace aspnetcore-runtime-7.0 in the previous command with dotnet-runtime-7.0.

sudo apt-get update
sudo apt-get install -y dotnet-runtime-7.0

New project

Create a console project:

dotnet new console -lang "C#"

Add a Nuget package

dotnet add package Aspose.Email --version 20.11.0

Build

dotnet build

Run

dotnet run

How to install and run a tool

dotnet new tool-manifest
dotnet tool install dotnet-xscgen --version 2.0.490
dotnet tool run xscgen 

See also

Favorite site

author Zer0 sitemap