Anyone who has set up .NET on a fresh Linux box knows the routine: a package manager that is a version behind, a tarball you unpack by hand, or the dotnet-install script plus a PATH edit you'll forget by next month. Microsoft has now put a proper tool in that gap. dotnetup entered public preview on October 15, announced on the .NET Blog by Chet Husk, who works on the SDK team, and it follows the model of Rust's rustup and Node's nvm.

I think it is worth ten minutes if you juggle more than one .NET version, mostly because of one design choice: you ask for a channel, not a version number. What follows is the day-to-day routine.

Prerequisites. macOS, Linux or Windows. No admin rights are needed; dotnetup keeps everything in your user directory. Because this is a preview, Microsoft's documentation says commands and behaviour may change between releases and that production machines should stay on installers, package managers or Visual Studio. We haven't run it ourselves, so the commands below come from Microsoft's announcement and the reporting of InfoQ, InfoWorld and Start Debugging.

Install it and run init

Microsoft's bootstrap scripts download the binary, check a SHA-512 checksum and put it in ~/.dotnetup. Pick yours:

CodeCopy 

macOS (zsh)

curl -fsSL https://aka.ms/dotnetup/get-dotnetup.sh | zsh

BashCopy 


shell

Linux (bash)

curl -fsSL https://aka.ms/dotnetup/get-dotnetup.sh | bash


powershell

Windows (PowerShell)

irm https://aka.ms/dotnetup/get-dotnetup.ps1 | iex

Then initialise:

CodeCopy 


shell
dotnetup init
dotnetup list


markdown

According to the announcement, init sets up your shell profile so dotnet works immediately and fetches the latest stable SDK. list prints what dotnetup manages in your home folder. InfoWorld's tester found that the installer printed two lines to run to set the path, so if dotnet isn't found in a fresh terminal, look at the installer's last output.

Choose an access mode before you accept the default

This is the step I'd slow down on. The tool has three modes that decide how .NET is exposed to your terminal and tools.

  • none leaves PATH and DOTNET_ROOT alone. You run everything through the tool, for example dotnetup dotnet build.
  • shell edits your shell profile so dotnet resolves to the managed install in terminal sessions.
  • everywhere changes the system PATH and sets DOTNET_ROOT, needs elevation, and is the default on Windows.

The documentation warns that everywhere takes precedence over machine-wide installs, including the one Visual Studio installs. A project that needs an SDK it hasn't installed can then fail to build. Setup offers to migrate existing machine-wide installs, but unless you plan to move everything, start with shell or none:

CodeCopy 


shell
dotnetup env set shell


markdown

The none mode is the safest way to try it out, since it touches nothing else on the machine.

Track channels instead of versions

The idea that separates it from the install scripts is that you request an intent:

  • latest or lts for the newest stable or long-term-support release
  • preview or daily for pre-release builds
  • a major such as 10, a minor such as 10.0, or a feature band such as 10.0.1xx

the tool resolves each to a concrete release. Exact versions you request stay pinned, so a requirement for 10.0.3 will not move on update. A feature band keeps following servicing releases within that band.

Monthly servicing becomes one command:

CodeCopy 


plaintext
dotnetup update


plaintext

It re-resolves every tracked channel and installs the newest matching versions, then removes components no remaining requirement needs. If you only want one piece, target it:

CodeCopy 


shell
dotnetup runtime install aspnetcore@10.0


markdown

Microsoft lists the SDK, the .NET runtime, the ASP.NET Core runtime and the Windows Desktop runtime as supported. One reminder from the announcement: updating your machine does not patch applications you've already shipped, and self-contained apps need to be republished with the new runtime.

Let global.json decide, per repository

Inside a repository, run dotnetup sdk install with no channel. It walks up from the current directory, uses the nearest global.json, and falls back to latest if none exists. A malformed file makes the command fail rather than silently using a parent directory. According to Start Debugging, it turns the file's rollForward setting into a tracked channel:

rollForward in global.json Channel dotnetup tracks
omitted or latestPatch 10.0.1xx (for an SDK like 10.0.103)
latestFeature 10.0
latestMinor 10
latestMajor latest
disable, patch, feature, minor, major exact version, never updated

So a team that pins 10.0.103 with latestPatch gets patch updates in the same feature band. dotnetup list shows the global.json path as the source of each requirement, which tells you which repo is keeping an old SDK installed. There's also a flag for teams that pin exact patch versions: dotnetup sdk install --update-global-json, and later dotnetup sdk update --update-global-json, installs the newest SDK in the derived channel and rewrites only sdk.version.

Microsoft's .NET logo, a purple square with white .NET lettering

Expand

Microsoft's .NET logo, a purple square with white .NET lettering

Image: Microsoft via Wikimedia Commons, Public domain

Test previews and daily builds without a mess

This used to mean hunting for tarballs on GitHub and editing environment variables. Now:

CodeCopy 


shell
dotnetup sdk install preview
dotnetup runtime install daily
dotnetup sdk install daily


markdown

They install next to your stable SDKs. The docs say daily builds aren't code-signed, so use them to check a bug fix, not to build anything you ship. To update the tool itself, run dotnetup self update.

Check which SDK your terminal and editor actually use

After any change in access mode, confirm what resolves. These are the standard .NET commands, and they work the same as before:

CodeCopy 


shell
dotnet --list-sdks
dotnet --info

Run them in a new terminal and again from your IDE's terminal. In shell mode, an editor started from a desktop launcher may not read your shell profile, so it can pick a different SDK from the one your terminal uses. If a build behaves differently in the IDE and on the command line, that is the first thing to compare. In none mode the equivalent is dotnetup dotnet -- --info, which forwards the command through dotnetup.

How it compares with what you do now

The dotnet-install scripts can fetch a specific version, and a distribution package manager will give you a supported system install. Microsoft's own list of what you give up with the scripts is short: tracking of what's installed, signature and checksum validation, faster installs of several versions at once, and one CLI across platforms. What it doesn't replace is a managed system install for production servers, which is exactly where the preview warning applies. My rule of thumb is to use it on developer machines and CI workers first, and leave servers on their package manager until the preview label comes off.

CI and containers

Because it needs no root rights and can run non-interactively, Microsoft pitches it for containers and short-lived CI workers where you need a specific SDK or a daily runtime. First-class GitHub Actions and Azure DevOps integration is on the roadmap, together with replacing parts of those tools that currently depend on the install scripts. Until then, call it from a script step.

Terminal window showing the output of a command-line DNS lookup

Expand

Terminal window showing the output of a command-line DNS lookup

Image: Gerard.burner via Wikimedia Commons, CC BY-SA 3.0

Troubleshooting

Projects stop building after init on Windows. You probably accepted everywhere mode, and the managed install now takes precedence over Visual Studio's SDKs. Switch with dotnetup env set shell or install the missing SDK through dotnetup.

global.json with sdk.paths misbehaves. Start Debugging reports that in this preview dotnetup installs to the first entry, treats $host$ as a literal path and doesn't skip empty entries. Omit sdk.paths or pass --install-path.

An uninstall removed more than you meant. dotnetup sdk uninstall 10.0.1xx --source globaljson removes every matching global.json requirement in the install root, not only the current repo's.

Different machines got different SDKs. InfoWorld's tester saw .NET 9 and 10 SDKs installed on Windows but only .NET 10 on macOS and Linux, and couldn't install ASP.NET on a Mac. Check dotnetup list after init instead of assuming parity.

You need admin-level installs on Windows. Not yet; Microsoft says support is planned.

The full CLI reference is in the dotnetup documentation on Microsoft Learn, and feedback goes to the dotnet/sdk discussions on GitHub.

Hero image: Microsoft .NET Blog, official artwork for the dotnetup announcement.

Originally published on Mango Developer.