Edit

dotnetup env script command

Note

dotnetup is in public preview. Its features and behavior might change before general availability.

Name

dotnetup env script - Generate shell code that activates dotnetup settings.

Synopsis

dotnetup env script [options]

Description

Without selection options, the generated script follows the stored configuration. If no configuration exists, it includes both the managed dotnet and dotnetup.

With selection options, it includes only the requested parts.

Options

Option Description
-s, --shell [<bash\|zsh\|fish\|pwsh>] Select the script syntax. If omitted, detect the current shell.
-d, --dotnet-install-path <PATH> Use a specific .NET installation root. The default is the default dotnetup-managed installation root.
--dotnet Add the selected .NET root to PATH and set DOTNET_ROOT.
--dotnetup Add the directory that contains dotnetup to PATH.
-?, -h, --help Show command help.

Examples

Activate the stored configuration in Bash:

eval "$(dotnetup env script --shell bash)"

Activate only a repository-local .NET installation in PowerShell:

dotnetup env script --shell pwsh --dotnet --dotnet-install-path .\.dotnet |
  Invoke-Expression

Generate script text without evaluating it:

dotnetup env script --shell fish --dotnet --dotnetup