Home > Mobile >  How to upgrade dotnet cli to the last version of 6?
How to upgrade dotnet cli to the last version of 6?

Time:11-27

I have .NET SDK (6.0.101) installed on my mac m1, and I run the dotnet using the cmd (zsh).

I want to upgrade the dotnet cli to the last version of 6 (using the cmd).

Is such a command exist? something like: dotnet --upgrade 6 and I'll get the latest 6 version?

CodePudding user response:

There is no command in the dotnet cli by itself, but microsoft provides distribution of dotnet via CLI script

Although this is not a recommended way to install it for the developer machine, but it works. There are plenty of flags to customize installation, check the documentation.

To upgrade dotnet version, you can use this script and point it to an existing installation via --install-dir flag. With correct --channel or --version values:

Example:


# download installation script
curl -L https://dot.net/v1/dotnet-install.sh -o /tmp/dotnet-install.sh

# install dotnet to a specific directory                                                                                                                                 sudo /tmp/dotnet-install.sh \
    --channel "${DOTNET_VERSION}" \
    --install-dir "${DOTNET_INSTALLATION_PATH}" \
    --architecture "x64"\
    --os "linux"
  •  Tags:  
  • .net
  • Related