How to remove the .NET Core Runtime and SDK
Over time, as you install updated versions of the .NET Core runtime and SDK, you may want to remove outdated versions of .NET Core from your machine. Removing older versions of the runtime may change the runtime chosen to run shared framework applications, as detailed in the article on .NET Core version selection.
Should I remove a version?
The .NET Core version selection behaviors and the runtime compatibility of .NET Core across updates enables safe removal of previous versions. .NET Core runtime updates are compatible within a major version ‘band’ such as 1.x and 2.x. Additionally, newer releases of the .NET Core SDK generally maintain the ability to build applications that target previous versions of the runtime in a compatible manner.
In general, you only need the latest SDK and latest patch version of the runtimes required for your application. Instances where you might want to keep older SDK or runtime versions include maintaining project.json-based applications. Unless your application has specific reasons for earlier SDKs or runtimes, you may safely remove older versions.
Determine what is installed
Starting with .NET Core 2.1, the .NET CLI has options you can use to list the versions of the SDK and runtime that are installed on your machine. Use dotnet —list-sdks to see the list of SDKs installed on your machine. Use dotnet —list-runtimes to see the list of runtimes installed on your machine. For more information, see How to check that .NET Core is already installed.
Uninstall .NET Core
.NET Core uses the Windows Apps & features dialog to remove versions of the .NET Core runtime and SDK. The following figure shows the Apps & features dialog. You can search for core sdk to filter and show installed versions of .NET Core.
Select any versions you want to remove from your machine and click Uninstall.
There are more options to uninstall .NET Core (either SDK or runtime) on Linux. The best way for you to uninstall .NET Core is to mirror the action you used to install .NET Core. The specifics depend on your chosen distribution and the installation method.
For Red Hat installations, consult the Red Hat Getting Started Guide for information on installing and uninstalling .NET Core.
Starting with .NET Core 2.1, there’s no need to uninstall the .NET Core SDK when upgrading it using a package manager. The package manager update or refresh commands will automatically remove the older version upon the successful installation of a newer version.
If you installed .NET Core using a package manager, you use that same package manager to uninstall .NET SDK or runtime. .NET Core installations support most popular package managers. Consult the documentation for your distribution’s package manager for the precise syntax in your environment:
- apt-get(8) is used by Debian based systems, including Ubuntu.
- yum(8) is used on Fedora, CentOS, and Oracle Linux.
- zypper(8) is used on openSUSE and SUSE Linux Enterprise System (SLES).
- dnf(8) is used on Fedora.
In almost all cases, the command to remove a package is remove .
The package name for the .NET Core SDK installation for most package managers is dotnet-sdk , followed by the version number. Starting with the version 2.1.300 of the .NET Core SDK and version 2.1 of the runtime, only the major and minor version numbers are necessary: for example, the .NET Core SDK version 2.1.300 can be referenced as the package dotnet-sdk-2.1 . Prior versions require the entire version string: for example, dotnet-sdk-2.1.200 would be required for version 2.1.200 of the .NET Core SDK.
For machines that have installed only the runtime, and not the SDK, the package name is dotnet-runtime- for the .NET Core runtime, and aspnetcore-runtime- for the entire runtime stack.
.NET Core installations earlier than 2.0 didn’t uninstall the host application when the SDK was uninstalled using the package manager. Using apt-get , the command is:
Note that there’s no version attached to dotnet-host .
If you installed using a tarball, you must remove .NET Core using the manual method.
On Linux, you must remove the SDKs and runtimes separately, by removing the versioned directories. Removing them deletes the SDK and runtime from disk. For example, to remove the 1.0.1 SDK and runtime, you would use the following bash commands:
The parent directories for the SDK and runtime are listed in the output from the dotnet —list-sdks and dotnet —list-runtimes command, as shown in the earlier table.
On Mac, you must remove the SDKs and runtimes separately, by removing the versioned directories. Removing them deletes the SDK and runtime from disk. For example, to remove the 1.0.1 SDK and runtime, you would use the following bash commands:
The parent directories for the SDK and runtime are listed in the output from the dotnet —list-sdks and dotnet —list-runtimes command, as shown in the earlier table.
.NET Core Uninstall Tool
The .NET Core Uninstall Tool ( dotnet-core-uninstall ) lets you remove .NET Core SDKs and runtimes from a system. A collection of options is available to specify which versions should be uninstalled.
Visual Studio dependency on .NET Core SDK versions
Before Visual Studio 2019 version 16.3, Visual Studio installers called the standalone .NET Core SDK installer. As a result, the SDK versions appear in the Windows Apps & features dialog. Removing .NET Core SDKs that were installed by Visual Studio using the standalone installer may break Visual Studio. If Visual Studio has problems after you uninstall SDKs, run Repair on that specific version of Visual Studio. The following table shows some of the Visual Studio dependencies on .NET Core SDK versions:
Visual Studio version | .NET Core SDK version |
---|---|
Visual Studio 2019 version 16.2 | .NET Core SDK 2.2.4xx, 2.1.8xx |
Visual Studio 2019 version 16.1 | .NET Core SDK 2.2.3xx, 2.1.7xx |
Visual Studio 2019 version 16.0 | .NET Core SDK 2.2.2xx, 2.1.6xx |
Visual Studio 2017 version 15.9 | .NET Core SDK 2.2.1xx, 2.1.5xx |
Visual Studio 2017 version 15.8 | .NET Core SDK 2.1.4xx |
Starting with Visual Studio 2019 version 16.3, Visual Studio is in charge of its own copy of the .NET Core SDK. For that reason, you no longer see those SDK versions in the Apps & features dialog.
Remove the NuGet fallback folder
Before .NET Core 3.0 SDK, the .NET Core SDK installers used a folder named NuGetFallbackFolder to store a cache of NuGet packages. This cache was used during operations such as dotnet restore or dotnet build /t:Restore . The NuGetFallbackFolder is located at C:\Program Files\dotnet\sdk on Windows and at /usr/local/share/dotnet/sdk on macOS.
You may want to remove this folder, if:
- You’re only developing using .NET Core 3.0 SDK or later versions.
- You’re developing using .NET Core SDK versions earlier than 3.0, but you can work online.
If you want to remove the NuGet fallback folder, you can delete it, but you’ll need admin privileges to do so.
It’s not recommended to delete the dotnet folder. Doing so would remove any global tools you’ve previously installed. Also, on Windows:
- You’ll break Visual Studio 2019 version 16.3 and later versions. You can run Repair to recover.
- If there are .NET Core SDK entries in the Apps & features dialog, they’ll be orphaned.
—>
Средство удаления .NET Core .NET Core Uninstall Tool
Средство удаления .NET Core ( dotnet-core-uninstall ) позволяет удалять пакеты SDK и среды выполнения .NET Core из системы. The .NET Core Uninstall Tool ( dotnet-core-uninstall ) lets you remove .NET Core SDKs and Runtimes from a system. Указать версии, которые нужно удалить, можно с помощью ряда параметров. A collection of options is available to specify which versions you want to uninstall.
Это средство поддерживают ОС Windows и macOS. The tool supports Windows and macOS. ОС Linux сейчас не поддерживает это средство. Linux is currently not supported.
В ОС Windows средство может удалять только пакеты SDK и среды выполнения, установленные с помощью одного из следующих установщиков: On Windows, the tool can only uninstall SDKs and Runtimes that were installed using one of the following installers:
- установщик сред выполнения и пакетов SDK для .NET Core; The .NET Core SDK and runtime installer.
- установщик Visual Studio более ранних версий, чем Visual Studio 2019 версии 16.3. The Visual Studio installer in versions earlier than Visual Studio 2019 version 16.3.
В macOS средство может удалять только пакеты SDK и среды выполнения, расположенные в папке /usr/local/share/dotnet. On macOS, the tool can only uninstall SDKs and runtimes located in the /usr/local/share/dotnet folder.
Из-за этих ограничений средство не сможет удалить все пакеты SDK и среды выполнения .NET Core на компьютере. Because of these limitations, the tool may not be able to uninstall all of the .NET Core SDKs and runtimes on your machine. Вы можете использовать команду dotnet —info , чтобы найти все установленные пакеты SDK и среды выполнения .NET Core, в том числе те, которые не удается удалить с помощью этого средства. You can use the dotnet —info command to find all of the .NET Core SDKs and runtimes installed, including those SDKs and runtimes that this tool can’t remove. Команда dotnet-core-uninstall list позволяет просмотреть, какие пакеты SDK можно удалить с помощью средства. The dotnet-core-uninstall list command displays which SDKs can be uninstalled with the tool.
Установка средства Install the tool
Средство удаления .NET Core можно скачать на странице со списком выпусков средства, а его исходный код доступен в репозитории GitHub dotnet/cli-lab. You can download the .NET Core Uninstall Tool from the tool’s releases page and find the source code at the dotnet/cli-lab GitHub repository.
Для удаления пакетов SDK и сред выполнения .NET Core средству требуются повышенные права. The tool requires elevation to uninstall .NET Core SDKs and runtimes. Следовательно, его нужно устанавливать в защищенном от записи каталоге, например C:\Program Files в ОС Windows или /usr/local/bin в macOS. Therefore, it should be installed in a write-protected directory such as C:\Program Files on Windows or /usr/local/bin on macOS. Ознакомьтесь также со статьей Повышенные права доступа для команд dotnet. See also Elevated access for dotnet commands. Дополнительные сведения см. в подробных инструкциях по установке. For more information, see the detailed installation instructions.
Запуск программы Run the tool
Шаги ниже демонстрируют рекомендуемый подход к работе со средством удаления. The following steps show the recommended approach for running the uninstall tool:
Шаг 1. Отображение установленных пакетов SDK и сред выполнения .NET Core Step 1 — Display installed .NET Core SDKs and runtimes
Команда dotnet-core-uninstall list перечисляет установленные пакеты SDK и среды выполнения .NET Core, которые можно удалить с помощью этого средства. The dotnet-core-uninstall list command lists the installed .NET Core SDKs and runtimes that can be removed with this tool. Некоторые пакеты SDK и среды выполнения могут требоваться для работы Visual Studio, и они отображаются с предупреждением о том, почему их не рекомендуется удалять. Some SDKs and runtimes may be required by Visual Studio and they’re displayed with a note of why it isn’t recommended to uninstall them.
В большинстве случаев выходные данные команды dotnet-core-uninstall list не будут соответствовать списку установленных версий в выходных данных dotnet —info . The output of the dotnet-core-uninstall list command will not match the list of installed versions in the output of dotnet —info in most cases. В частности, это средство не будет отображать версии, установленные ZIP-файлами или управляемые Visual Studio (любая версия, установленная с Visual Studio 2019 версии 16.3 или более поздней версии). Specifically, this tool will not display versions installed by zip files or managed by Visual Studio (any version installed with Visual Studio 2019 16.3 or later). Один из способов проверить, находится ли версия под управлением Visual Studio, — просмотреть ее в Add or Remove Programs , в которой управляемые версии Visual Studio помечены в отображаемых именах. One way to check if a version is managed by Visual Studio is to view it in Add or Remove Programs , where Visual Studio managed versions are marked as such in their display names.
dotnet-core-uninstall list dotnet-core-uninstall list
Краткий обзор Synopsis
Параметры Options
—aspnet-runtime
Перечисляет все среды выполнения ASP.NET Core, которые можно удалить с помощью этого средства. Lists all the ASP.NET Core runtimes that can be uninstalled with this tool.
—hosting-bundle
Перечисляет все пакеты размещения .NET Core, которые можно удалить с помощью этого средства. Lists all the .NET Core hosting bundles that can be uninstalled with this tool.
—runtime
Перечисляет все среды выполнения .NET Core, которые можно удалить с помощью этого средства. Lists all .NET Core runtimes that can be uninstalled with this tool.
Перечисляет все пакеты SDK для .NET Core, которые можно удалить с помощью этого средства. Lists all .NET Core SDKs that can be uninstalled with this tool.
-v, —verbosity
Устанавливает уровень детализации. Sets the verbosity level. Допустимые значения: q[uiet] , m[inimal] , n[ormal] , d[etailed] и diag[nostic] . Allowed values are q[uiet] , m[inimal] , n[ormal] , d[etailed] , and diag[nostic] . Значение по умолчанию — normal . The default value is normal .
Перечисляет все пакеты SDK и среды выполнения .NET Core x64, которые можно удалить с помощью этого средства. Lists all x64 .NET Core SDKs and runtimes that can be uninstalled with this tool.
Перечисляет все пакеты SDK и среды выполнения .NET Core x86, которые можно удалить с помощью этого средства. Lists all x86 .NET Core SDKs and runtimes that can be uninstalled with this tool.
—runtime
Перечисляет все среды выполнения .NET Core, которые можно удалить с помощью этого средства. Lists all .NET Core runtimes that can be uninstalled with this tool.
Перечисляет все пакеты SDK для .NET Core, которые можно удалить с помощью этого средства. Lists all .NET Core SDKs that can be uninstalled with this tool.
-v, —verbosity
Устанавливает уровень детализации. Sets the verbosity level. Допустимые значения: q[uiet] , m[inimal] , n[ormal] , d[etailed] и diag[nostic] . Allowed values are q[uiet] , m[inimal] , n[ormal] , d[etailed] , and diag[nostic] . Значение по умолчанию — normal . The default value is normal .
Примеры Examples
Перечисление всех пакетов SDK и сред выполнения .NET Core, которые можно удалить с помощью этого средства: List all .NET Core SDKs and runtimes that can be removed with this tool:
Перечисление всех пакетов SDK и сред выполнения .NET Core x64: List all x64 .NET Core SDKs and runtimes:
Перечисление всех пакетов SDK для .NET Core x86: List all x86 .NET Core SDKs:
Шаг 2. Пробный запуск Step 2 — Do a dry run
Команды dotnet-core-uninstall dry-run и dotnet-core-uninstall whatif позволяют просмотреть пакеты SDK и среды выполнения .NET Core, которые будут удалены, на основе указанных параметров без выполнения удаления. The dotnet-core-uninstall dry-run and dotnet-core-uninstall whatif commands display the .NET Core SDKs and runtimes that will be removed based on the options provided without performing the uninstall. Эти синонимичные команды. These commands are synonyms.
dotnet-core-uninstall dry-run and dotnet-core-uninstall whatif dotnet-core-uninstall dry-run and dotnet-core-uninstall whatif
Краткий обзор Synopsis
Аргументы Arguments
VERSION
Указанная версия для удаления. The specified version to uninstall. Вы можете перечислить несколько версий одну за другой, разделяя их пробелами. You may list several versions one after the other, separated by spaces. Поддерживаются также файлы ответов. Response files are also supported.
Файлы ответов можно использовать вместо того, чтобы указывать все версии в командной строке. Response files are an alternative to placing all the versions on the command line. Это текстовые файлы, обычно с расширением *.rsp. Каждая версия указывается в отдельной строке. They’re text files, typically with a *.rsp extension, and each version is listed on a separate line. Чтобы указать файл ответов для аргумента VERSION , используйте символ @ сразу после имени файла ответа. To specify a response file for the VERSION argument, use the @ character immediately followed by the response file name.
Параметры Options
Удаляет все пакеты SDK и среды выполнения .NET Core. Removes all .NET Core SDKs and runtimes.
—all-below [ . ]
Удаляет только пакеты SDK и среды .NET Core, версия которых вышла раньше, чем указанная. Removes only the .NET Core SDKs and runtimes with a version smaller than the specified version. Указанная версия не удаляется. The specified version remains installed.
—all-but [ . ]
Удаляет все пакеты SDK и среды выполнения .NET Core, за исключением указанных версий. Removes all .NET Core SDKs and runtimes, except those versions specified.
—all-but-latest
Удаляет пакеты SDK и среды выполнения .NET Core, за исключением самых поздних версий. Removes .NET Core SDKs and runtimes, except the one highest version.
—all-lower-patches
Удаляет пакеты SDK и среды выполнения .NET Core, замененные более поздними исправлениями. Removes .NET Core SDKs and runtimes superseded by higher patches. Этот параметр обеспечивает защиту файла global.json. This option protects global.json.
—all-previews
Удаляет пакеты SDK и среды выполнения .NET Core, помеченные как предварительные версии. Removes .NET Core SDKs and runtimes marked as previews.
—all-previews-but-latest
Удаляет пакеты SDK и среды выполнения .NET Core, помеченные как предварительные версии, за исключением самых поздних. Removes .NET Core SDKs and runtimes marked as previews except the one highest preview.
—aspnet-runtime
Удаляет только среды выполнения ASP.NET Core. Removes ASP.NET Core runtimes only.
—hosting-bundle
Удаляет только среду выполнения и пакеты размещения .NET Core. Removes .NET Core runtime and hosting bundles only.
—major-minor
Удаляет пакеты SDK и среды выполнения .NET Core, соответствующие указанной версии major.minor . Removes .NET Core SDKs and runtimes that match the specified major.minor version.
—runtime
Удаляет только среды выполнения .NET Core. Removes .NET Core runtimes only.
Удаляет только пакеты SDK для .NET Core. Removes .NET Core SDKs only.
-v, —verbosity
Устанавливает уровень детализации. Sets the verbosity level. Допустимые значения: q[uiet] , m[inimal] , n[ormal] , d[etailed] и diag[nostic] . Allowed values are q[uiet] , m[inimal] , n[ormal] , d[etailed] , and diag[nostic] . Значение по умолчанию — normal . The default value is normal .
Необходимо использовать с —sdk , —runtime и —aspnet-runtime для удаления пакетов SDK или сред выполнения x64. Must be used with —sdk , —runtime , and —aspnet-runtime to remove x64 SDKs or runtimes.
Необходимо использовать с —sdk , —runtime и —aspnet-runtime для удаления пакетов SDK или сред выполнения x86. Must be used with —sdk , —runtime , and —aspnet-runtime to remove x86 SDKs or runtimes.
—force Принудительно удаляет версии, которые могут использоваться в Visual Studio. —force Forces removal of versions that might be used by Visual Studio.
- Требуется только один из параметров —sdk , —runtime , —aspnet-runtime или —hosting-bundle . Exactly one of —sdk , —runtime , —aspnet-runtime , and —hosting-bundle is required.
- Параметры —all , —all-below , —all-but , —all-but-latest , —all-lower-patches , —all-previews , —all-previews-but-latest , —major-minor и [ . ] служат для исключения. —all , —all-below , —all-but , —all-but-latest , —all-lower-patches , —all-previews , —all-previews-but-latest , —major-minor , and [ . ] are exclusive.
- Если —x64 или —x86 не указаны, будут удалены обе версии. If —x64 or —x86 aren’t specified, then both x64 and x86 will be removed.
- Требуется указать только один параметр: —sdk или —runtime . Exactly one of —sdk and —runtime is required.
- Параметры —all , —all-below , —all-but , —all-but-latest , —all-lower-patches , —all-previews , —all-previews-but-latest , —major-minor и [ . ] служат для исключения. —all , —all-below , —all-but , —all-but-latest , —all-lower-patches , —all-previews , —all-previews-but-latest , —major-minor , and [ . ] are exclusive.
- Это средство может удалять версии пакета SDK для .NET Core, необходимые для файлов global.json на компьютере. This tool can uninstall versions of the .NET Core SDK that are required by global.json files on your machine. Эти пакеты можно повторно установить, предварительно скачав их на этой странице. You can reinstall .NET Core SDKs from the Download .NET Core page.
- Средство может удалять версии среды выполнения .NET Core, необходимые для зависимых от платформы приложений на компьютере. This tool can uninstall versions of the .NET Core runtime that are required by framework dependent applications on your machine. Вы можете переустановить среду выполнения .NET Core, предварительно скачав ее с этой страницы. You can reinstall .NET Core runtimes from the Download .NET Core page.
- Это средство может удалять версии пакета SDK и среды выполнения .NET Core, от которых зависит работа Visual Studio. This tool can uninstall versions of the .NET Core SDK and runtime that Visual Studio relies on. Если нарушите работу установленной версии Visual Studio, выполните команду «Исправить» в установщике Visual Studio, чтобы восстановить рабочее состояние. If you break your Visual Studio installation, run «Repair» in the Visual Studio installer to get back to a working state.
- Требуется только один из параметров —sdk , —runtime , —aspnet-runtime или —hosting-bundle . Exactly one of —sdk , —runtime , —aspnet-runtime , and —hosting-bundle is required.
- Параметры —all , —all-below , —all-but , —all-but-latest , —all-lower-patches , —all-previews , —all-previews-but-latest , —major-minor и [ . ] служат для исключения. —all , —all-below , —all-but , —all-but-latest , —all-lower-patches , —all-previews , —all-previews-but-latest , —major-minor , and [ . ] are exclusive.
- Если —x64 или —x86 не указаны, будут удалены обе версии. If —x64 or —x86 aren’t specified, then both x64 and x86 will be removed.
- Требуется указать только один параметр: —sdk или —runtime . Exactly one of —sdk and —runtime is required.
- Параметры —all , —all-below , —all-but , —all-but-latest , —all-lower-patches , —all-previews , —all-previews-but-latest , —major-minor и [ . ] служат для исключения. —all , —all-below , —all-but , —all-but-latest , —all-lower-patches , —all-previews , —all-previews-but-latest , —major-minor , and [ . ] are exclusive.
Удаляет все пакеты SDK и среды выполнения .NET Core. Removes all .NET Core SDKs and runtimes.
—all-below [ . ]
Удаляет пакеты SDK и среды выполнения .NET Core, версия которых вышла ранее, чем указанная. Removes .NET Core SDKs and runtimes below the specified version. Указанная версия не будет удалена. The specified version will remain.
—all-but [ . ]
Удаляет пакеты SDK и среды выполнения .NET Core, за исключением указанных версий. Removes .NET Core SDKs and runtimes, except those versions specified.
—all-but-latest
Удаляет пакеты SDK и среды выполнения .NET Core, за исключением самых поздних версий. Removes .NET Core SDKs and runtimes, except the one highest version.
—all-lower-patches
Удаляет пакеты SDK и среды выполнения .NET Core, замененные более поздними исправлениями. Removes .NET Core SDKs and runtimes superseded by higher patches. Этот параметр обеспечивает защиту файла global.json. This option protects global.json.
—all-previews
Удаляет пакеты SDK и среды выполнения .NET Core, помеченные как предварительные версии. Removes .NET Core SDKs and runtimes marked as previews.
—all-previews-but-latest
Удаляет пакеты SDK и среды выполнения .NET Core, помеченные как предварительные версии, за исключением самых поздних. Removes .NET Core SDKs and runtimes marked as previews except the one highest preview.
—major-minor
Удаляет пакеты SDK и среды выполнения .NET Core, соответствующие указанной версии major.minor . Removes .NET Core SDKs and runtimes that match the specified major.minor version.
—runtime
Удаляет только среды выполнения .NET Core. Removes .NET Core runtimes only.
Удаляет только пакеты SDK для .NET Core. Removes .NET Core SDKs only.
-v, —verbosity
Устанавливает уровень детализации. Sets the verbosity level. Допустимые значения: q[uiet] , m[inimal] , n[ormal] , d[etailed] и diag[nostic] . Allowed values are q[uiet] , m[inimal] , n[ormal] , d[etailed] , and diag[nostic] . Значение по умолчанию — normal . The default value is normal .
—force Принудительно удаляет версии, которые могут использоваться Visual Studio или пакетами SDK. —force Forces removal of versions that might be used by Visual Studio or SDKs.
Примеры Examples
По умолчанию пакеты SDK и среды выполнения .NET Core, которые могут требоваться для работы Visual Studio или других пакетов SDK, не включаются в выходные данные dotnet-core-uninstall dry-run . By default, .NET Core SDKs and runtimes that may be required by Visual Studio or other SDKs are not included in dotnet-core-uninstall dry-run output. В примерах ниже некоторые указанные пакеты SDK и среды выполнения могут быть исключены из выходных данных в зависимости от состояния компьютера. In the following examples, some of the specified SDKs and runtimes may not be included in the output, depending on the state of the machine. Чтобы включить все пакеты SDK и среды выполнения, укажите их явно в качестве аргументов или используйте параметр —force . To include all SDKs and runtimes, list them explicitly as arguments or use the —force option.
Пробный запуск удаления всех сред выполнения .NET Core, замененных более поздними версиями: Dry run of removing all .NET Core runtimes that have been superseded by higher patches:
Пробный запуск удаления всех пакетов SDK для .NET Core, версия которых вышла раньше 2.2.301 : Dry run of removing all .NET Core SDKs below the version 2.2.301 :
Шаг 3. Удаление пакетов SDK и сред выполнения .NET Core Step 3 — Uninstall .NET Core SDKs and Runtimes
Команда dotnet-core-uninstall remove удаляет пакеты SDK и среды выполнения .NET Core, указанные с использованием коллекции параметров. dotnet-core-uninstall remove uninstalls .NET Core SDKs and Runtimes that are specified by a collection of options. Средство нельзя использовать для удаления пакетов SDK и сред выполнения с версией 5.0 или более поздней. The tool can’t be used to uninstall SDKs and Runtimes with version 5.0 or above.
У средства разрушающее поведение, поэтому настоятельно рекомендуется выполнять пробный запуск перед выполнением команды удаления. Since this tool has a destructive behavior, it’s highly recommended that you do a dry run before running the remove command. В ходе пробного запуска будут показаны пакеты SDK и среды .NET Core, подлежащие удалению при использовании команды remove . The dry run will show you what .NET Core SDKs and runtimes will be removed when you use the remove command. Чтобы узнать, какие пакеты SDK и среды выполнения безопасно удалять, обратитесь к разделу Нужно ли удалять версию. Refer to Should I remove a version? to learn which SDKs and runtimes are safe to remove.
Учитывайте следующие факторы. Keep in mind the following caveats:
По умолчанию все команды поддерживают пакеты SDK и среды выполнения .NET Core, которые могут потребоваться для работы Visual Studio или других пакетов SDK. By default, all commands keep the .NET Core SDKs and runtimes that may be required by Visual Studio or other SDKs. Эти пакеты и среды выполнения можно удалить путем их явного перечисления в виде аргументов или с использованием параметра —force . These SDKs and runtimes can be uninstalled by listing them explicitly as arguments or by using the —force option.
Для удаления пакетов SDK и сред выполнения .NET Core средству требуются повышенные права. The tool requires elevation to uninstall .NET Core SDKs and runtimes. Запустите средство в командной строке администратора в ОС Windows или с помощью команды sudo в macOS. Run the tool in an Administrator command prompt on Windows and with sudo on macOS. Для команд dry-run и whatif повышение прав не требуется. The dry-run and whatif commands don’t require elevation.
dotnet-core-uninstall remove dotnet-core-uninstall remove
Краткий обзор Synopsis
Аргументы Arguments
VERSION
Указанная версия для удаления. The specified version to uninstall. Вы можете перечислить несколько версий одну за другой, разделяя их пробелами. You may list several versions one after the other, separated by spaces. Поддерживаются также файлы ответов. Response files are also supported.
Файлы ответов можно использовать вместо того, чтобы указывать все версии в командной строке. Response files are an alternative to placing all the versions on the command line. Это текстовые файлы, обычно с расширением *.rsp. Каждая версия указывается в отдельной строке. They’re text files, typically with a *.rsp extension, and each version is listed on a separate line. Чтобы указать файл ответов для аргумента VERSION , используйте символ @ сразу после имени файла ответа. To specify a response file for the VERSION argument, use the @ character immediately followed by the response file name.
Параметры Options
Удаляет все пакеты SDK и среды выполнения .NET Core. Removes all .NET Core SDKs and runtimes.
—all-below [ . ]
Удаляет только пакеты SDK и среды .NET Core, версия которых вышла раньше, чем указанная. Removes only the .NET Core SDKs and runtimes with a version smaller than the specified version. Указанная версия не удаляется. The specified version remains installed.
—all-but [ . ]
Удаляет все пакеты SDK и среды выполнения .NET Core, за исключением указанных версий. Removes all .NET Core SDKs and runtimes, except those versions specified.
—all-but-latest
Удаляет пакеты SDK и среды выполнения .NET Core, за исключением самых поздних версий. Removes .NET Core SDKs and runtimes, except the one highest version.
—all-lower-patches
Удаляет пакеты SDK и среды выполнения .NET Core, замененные более поздними исправлениями. Removes .NET Core SDKs and runtimes superseded by higher patches. Этот параметр обеспечивает защиту файла global.json. This option protects global.json.
—all-previews
Удаляет пакеты SDK и среды выполнения .NET Core, помеченные как предварительные версии. Removes .NET Core SDKs and runtimes marked as previews.
—all-previews-but-latest
Удаляет пакеты SDK и среды выполнения .NET Core, помеченные как предварительные версии, за исключением самых поздних. Removes .NET Core SDKs and runtimes marked as previews except the one highest preview.
—aspnet-runtime
Удаляет только среды выполнения ASP.NET Core. Removes ASP.NET Core runtimes only.
—hosting-bundle
Удаляет только пакеты размещения .NET Core. Removes .NET Core hosting bundles only.
—major-minor
Удаляет пакеты SDK и среды выполнения .NET Core, соответствующие указанной версии major.minor . Removes .NET Core SDKs and runtimes that match the specified major.minor version.
—runtime
Удаляет только среды выполнения .NET Core. Removes .NET Core runtimes only.
Удаляет только пакеты SDK для .NET Core. Removes .NET Core SDKs only.
-v, —verbosity
Устанавливает уровень детализации. Sets the verbosity level. Допустимые значения: q[uiet] , m[inimal] , n[ormal] , d[etailed] и diag[nostic] . Allowed values are q[uiet] , m[inimal] , n[ormal] , d[etailed] , and diag[nostic] . Значение по умолчанию — normal . The default value is normal .
Необходимо использовать с —sdk , —runtime и —aspnet-runtime для удаления пакетов SDK или сред выполнения x64. Must be used with —sdk , —runtime , and —aspnet-runtime to remove x64 SDKs or runtimes.
Необходимо использовать с —sdk , —runtime и —aspnet-runtime для удаления пакетов SDK или сред выполнения x86. Must be used with —sdk , —runtime , and —aspnet-runtime to remove x86 SDKs or runtimes.
-y, —yes Выполняет команду без подтверждения Yes или No. -y, —yes Executes the command without requiring a yes or no confirmation.
—force Принудительно удаляет версии, которые могут использоваться в Visual Studio. —force Forces removal of versions that might be used by Visual Studio.
Удаляет все пакеты SDK и среды выполнения .NET Core. Removes all .NET Core SDKs and runtimes.
—all-below [ . ]
Удаляет пакеты SDK и среды выполнения .NET Core, версия которых вышла ранее, чем указанная. Removes .NET Core SDKs and runtimes below the specified version. Указанная версия не будет удалена. The specified version will remain.
—all-but [ . ]
Удаляет пакеты SDK и среды выполнения .NET Core, за исключением указанных версий. Removes .NET Core SDKs and runtimes, except those versions specified.
—all-but-latest
Удаляет пакеты SDK и среды выполнения .NET Core, за исключением самых поздних версий. Removes .NET Core SDKs and runtimes, except the one highest version.
—all-lower-patches
Удаляет пакеты SDK и среды выполнения .NET Core, замененные более поздними исправлениями. Removes .NET Core SDKs and runtimes superseded by higher patches. Этот параметр обеспечивает защиту файла global.json. This option protects global.json.
—all-previews
Удаляет пакеты SDK и среды выполнения .NET Core, помеченные как предварительные версии. Removes .NET Core SDKs and runtimes marked as previews.
—all-previews-but-latest
Удаляет пакеты SDK и среды выполнения .NET Core, помеченные как предварительные версии, за исключением самых поздних. Removes .NET Core SDKs and runtimes marked as previews except the one highest preview.
—major-minor
Удаляет пакеты SDK и среды выполнения .NET Core, соответствующие указанной версии major.minor . Removes .NET Core SDKs and runtimes that match the specified major.minor version.
—runtime
Удаляет только среды выполнения .NET Core. Removes .NET Core runtimes only.
Удаляет только пакеты SDK для .NET Core. Removes .NET Core SDKs only.
-v, —verbosity
Устанавливает уровень детализации. Sets the verbosity level. Допустимые значения: q[uiet] , m[inimal] , n[ormal] , d[etailed] и diag[nostic] . Allowed values are q[uiet] , m[inimal] , n[ormal] , d[etailed] , and diag[nostic] . Значение по умолчанию — normal . The default value is normal .
-y, —yes Выполняет команду без подтверждения Yes или No. -y, —yes Executes the command without requiring Y/N confirmation.
—force Принудительно удаляет версии, которые могут использоваться Visual Studio или пакетами SDK. —force Forces removal of versions that might be used by Visual Studio or SDKs.
Примеры Examples
По умолчанию пакеты SDK и среды выполнения .NET Core, которые могут требоваться для работы Visual Studio или других пакетов SDK, сохраняются. By default, .NET Core SDKs and runtimes that may be required by Visual Studio or other SDKs are kept. В примерах ниже могут остаться некоторые из указанных пакетов SDK и сред выполнения в зависимости от состояния компьютера. In the following examples, some of the specified SDKs and runtimes may remain, depending on the state of the machine. Чтобы удалить все пакеты и среды выполнения, укажите их явно в качестве аргументов или используйте параметр —force . To remove all SDKs and runtimes, list them explicitly as arguments or use the —force option.
Удаление всех сред выполнения .NET Core, кроме версии 3.0.0-preview6-27804-01 без подтверждения Yes или No: Remove all .NET Core runtimes except the version 3.0.0-preview6-27804-01 without requiring Y/N confirmation:
Удаление всех пакетов SDK для .NET Core 1.1 без подтверждения Yes или No: Remove all .NET Core 1.1 SDKs without requiring Y/n confirmation:
Удаление пакета SDK для .NET Core 1.1.11 без вывода на консоль: Remove the .NET Core 1.1.11 SDK with no console output:
Удаление всех пакетов SDK для .NET Core, которые можно безопасно удалить с помощью этого средства: Remove all .NET Core SDKs that can safely be removed by this tool:
Удаление всех пакетов SDK для .NET Core, которые можно безопасно удалить с помощью этого средства, в том числе тех, которые могут требоваться для работы Visual Studio (не рекомендуется): Remove all .NET Core SDKs that can be removed by this tool, including those SDKs that may be required by Visual Studio (not recommended):
Удаление всех пакетов SDK для .NET Core, указанных в файле ответов versions.rsp : Remove all .NET Core SDKs that are specified in the response file versions.rsp
В файле versions.rsp содержится следующее: The content of versions.rsp is as follows:
Шаг 4. Удаление резервной папки NuGet (необязательный) Step 4 — Delete the NuGet fallback folder (optional)
В некоторых случаях папка NuGetFallbackFolder может больше не требоваться, и ее понадобится удалить. In some cases, you no longer need the NuGetFallbackFolder and may wish to delete it. Дополнительные сведения об удалении папки NuGetFallbackFolder см. в этом разделе. For more information about deleting this folder, see Remove the NuGetFallbackFolder.