Skip to content

dotnetup: Support custom dotnet roots #55346

Open

Description

@dsplaisted

We have an --install-path parameter, but I'm not sure it works consistently and if you want to use a different install root, you have to specify it on every command.

I think we should probably support specifying the path for the dotnet root / hive that dotnetup uses by default. That should be a setting that is saved in the config, and synced with the env commands.

Then I think the scenario for specifying it on an install command line is really just for untracked installs.

Suggested commands:

  • dotnetup env set --install-path <PATH> - Set the install path dotnetup will use for dotnet
  • dotnet sdk install <VERSION> --untracked <PATH> - Install to the specified path in untracked mode. We'd remove the existing --install-path parameter on the install commands

Activity

  1. added
    untriaged
    on Jul 17, 2026
  2. added
    Area-dotnetup
    on Jul 17, 2026
  3. nagilson commented on Aug 6, 2026

    @nagilson
    Member

    We have an environment variable that lets this work, DOTNET_TESTHOOK_DEFAULT_DOTNET_PATH. Should we simply rename this environment variable to be something like DOTNETUP_DOTNET_HOME?

  4. kazo0 commented on Oct 27, 2026

    @kazo0

    Adding a real-world case for this, from macOS (dotnetup 0.3.0-preview.1.26511.1, osx-arm64).

    Why I needed a custom root: the macOS default, ~/Library/Application Support/dotnetup/dotnet, has a space in it. With wasm-tools, the Emscripten clang wrappers in Microsoft.NET.Runtime.Emscripten.3.1.56.Sdk.osx-arm64 10.0.14 contain CLANG_CC=$(dirname $0)/clang-19, so any WebAssembly build that relinks natively (for example an app using SkiaSharp) fails:

    .../tools/bin/clang: line 25: /Users/<user>/Library: No such file or directory
    emcc: error: '".../Application Support/dotnetup/dotnet/packs/Microsoft.NET.Runtime.Emscripten.3.1.56.Sdk.osx-arm64/10.0.14/tools/bin/clang" --version' failed (returned 127)
    

    That wrapper is already quoted on release/10.0.1xx in dotnet/dotnet, so it should be fixed in a later servicing release. But other tools that don't quote paths will trip over the same default root.

    What happened when I moved: dotnetup install <channels> --install-path ~/dotnet --set-default-install installed fine, but dotnetup env script --shell zsh --dotnet --dotnetup (the line dotnetup init writes into the profile) still emits DOTNET_ROOT and PATH for the old root. dotnetup.config.json stores no path, and env set has no option for one. The only fix was editing the profile hook to pass -d "$HOME/dotnet". So --set-default-install looks like a no-op for new shells, which is the gap this issue describes.

    +1 to persisting the root in config and having env follow it. Separately, a default root without spaces on macOS (for example ~/.dotnetup/dotnet, next to the executable) would have avoided this entirely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-dotnetupuntriaged

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions