Note
dotnetup 为公共预览版。 在正式发布之前,其功能和行为可能会更改。
Name
dotnetup env script - 生成激活 dotnetup 设置的 shell 代码。
Synopsis
dotnetup env script [options]
说明
如果没有选择选项,生成的脚本将遵循存储的配置。 如果不存在配置,则包含托管 dotnet 和 dotnetup.
使用选择选项时,它仅包含请求的部分。
选项
| 选项 | 说明 |
|---|---|
-s、--shell [<bash\|zsh\|fish\|pwsh>] |
选择脚本语法。 如果省略,请检测当前 shell。 |
-d、--dotnet-install-path <PATH> |
使用特定的.NET安装根目录。 默认值为默认 dotnetup 托管安装根目录。 |
--dotnet |
将所选.NET根添加到PATH并设置DOTNET_ROOT。 |
--dotnetup |
将包含 dotnetup 的目录添加到 PATH. |
-?、-h、--help |
显示命令帮助。 |
Examples
在 Bash 中激活存储的配置:
eval "$(dotnetup env script --shell bash)"
仅在 PowerShell 中激活存储库本地.NET安装:
dotnetup env script --shell pwsh --dotnet --dotnet-install-path .\.dotnet |
Invoke-Expression
在不评估脚本文本的情况下生成脚本文本:
dotnetup env script --shell fish --dotnet --dotnetup