本文适用于: ✔️ .NET 卸载工具 1.7.521001 及更高版本
Name
dotnet-core-uninstall dry-run - 显示将被删除的 .NET SDK 和运行时。
Tip
dotnet-core-uninstall whatif 命令与 dry-run 命令相同。
Synopsis
dotnet-core-uninstall dry-run <TARGET> <FILTER> [-v|--verbosity <LEVEL>]
[--force] [-y|--yes]
dotnet-core-uninstall dry-run -h|--help
dotnet-core-uninstall dry-run <TARGET> <FILTER> [-v|--verbosity <LEVEL>]
[--force] [-y|--yes] [--preserve-vs-for-mac-sdks]
dotnet-core-uninstall dry-run -h|--help
Description
dotnet-core-uninstall dry-run 命令用于模拟删除 .NET SDK 和运行时环境。 为每个本应被该工具移除的 .NET SDK 和运行时提供了状态输出。
Arguments
VERSION
要卸载的版本。 可以列出用空格分隔的多个版本。 此外还支持响应文件。
Tip
响应文件是在命令行上放置所有版本的替代方法。 它们是文本文件,通常具有 *.rsp 扩展名,每个版本都在单独的行上列出。 若要为 VERSION 参数指定响应文件,请使用后面紧跟响应文件名的 @ 字符。
选项 - 目标
--aspnet-runtime仅删除 ASP.NET Core 运行时。
--hosting-bundle仅删除.NET核心运行时和托管捆绑包。
--runtime仅删除 .NET Core 运行时。
--sdk仅删除 .NET Core SDK。
--windows-desktop-runtime仅删除 Windows 桌面运行时。
--arm64与
--sdk、--runtime、--aspnet-runtime和--windows-desktop-runtime一起使用,以移除 arm64。--x64配合
--sdk、--runtime、--aspnet-runtime和--windows-desktop-runtime使用,以移除 x64。--x86与
--sdk、--runtime、--aspnet-runtime和--windows-desktop-runtime一起使用,以移除 x86。
--runtime仅删除 .NET Core 运行时。
--sdk仅删除 .NET Core SDK。
选项 - 筛选器
这些选项是独占的。
--all删除所有 .NET SDK 和运行时。
--all-below <VERSION>[ <VERSION>...]仅删除版本小于指定版本的 .NET SDK 和运行时。 仍安装指定版本。
--all-but <VERSION>[ <VERSION>...]除了那些指定版本外,删除所有 .NET SDK 和运行时。
--all-but-latest删除 .NET SDK 和运行时(最高版本除外)。
--all-lower-patches删除由更高版本的补丁取代的 .NET SDK 和运行时。 此选项保护 global.json 文件。
--all-previews删除标记为预览版的 .NET SDK 和运行时。
--all-previews-but-latest删除标记为预览版的 .NET SDK 和运行时(最高预览版除外)。
--major-minor <MAJOR_MINOR>删除与指定
major.minor版本相匹配的 .NET SDK 和运行时。
选项
--force强制删除可能由 Visual Studio 使用的版本。
--force强制删除 Visual Studio for Mac 或 SDK 可能使用的版本。
--preserve-vs-for-mac-sdks防止删除Visual Studio for Mac 使用概率较高的 SDK 和运行时。
Note
Visual Studio for Mac 不受支持。
-v, --verbosity <LEVEL>设置详细程度。 允许值包括:
q[uiet]m[inimal]n[ormal]d[etailed]diag[nostic]
-?|-h|--help显示帮助和使用情况信息。
Note
默认情况下,不会删除Visual Studio使用概率较高的 SDK 和运行时。 若要删除这些项,请单独指定它们或使用 --force。 如果删除 SDK 或运行时会导致Visual Studio安装出现问题,请运行修复。 SDK 和运行时可在 https://aka.ms/dotnet-core-download 下载。
Note
使用 --preserve-vs-for-mac-sdks 防止删除Visual Studio for Mac 使用概率较高的 SDK 和运行时。 Visual Studio for Mac 不受支持。 SDK 和运行时可在 https://aka.ms/dotnet-core-download 下载。
试运行删除已被较高版本的修补程序取代的所有 .NET 运行时:
dotnet-core-uninstall dry-run --all-lower-patches --runtime试运行删除低于版本
6.0.301的所有 .NET SDK:dotnet-core-uninstall dry-run --all-below 6.0.301 --sdk