Saturday, August 5, 2023

How to install dotnet cli in Linux or WSL



1. Download Dotnet-install shell script
```sh
wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh
chmod +x ./dotnet-install.sh
```

2. Install latest.NET  SDK using dotnet-install.sh

```sh
./dotnet-install.sh --version latest

```


2.1 Install .NET Runtime instead of the SDK, use the --runtime parameter.
```sh
./dotnet-install.sh --version latest --runtime aspnetcore
```

You can install a specific major version with the --channel parameter to indicate the specific version. The following command installs .NET 7.0 SDK.

```
Bash
./dotnet-install.sh --channel 7.0
```

3. Set Environment variables for DOTNET_Root and update Path environment variable

```sh 
~/.bashrc

export DOTNET_ROOT=$HOME/.dotnet

export PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools

```


No comments:

Post a Comment