Справка по скриптам dotnet-install dotnet-install scripts reference
name Name
dotnet-install.ps1 | dotnet-install.sh — скрипт, используемый для установки общей среды выполнения и пакета SDK для .NET. dotnet-install.ps1 | dotnet-install.sh — Script used to install the .NET SDK and the shared runtime.
Краткий обзор Synopsis
Linux или MacOS: Linux/macOS:
Так как bash-скрипт также считывает параметры PowerShell, их можно использовать с этим скриптом в системах Linux и macOS. The bash script also reads PowerShell switches, so you can use PowerShell switches with the script on Linux/macOS systems.
Описание Description
Скрипты dotnet-install выполняют установку пакета SDK для .NET без прав администратора. Этот пакет включает общую среду выполнения и .NET CLI. The dotnet-install scripts perform a non-admin installation of the .NET SDK, which includes the .NET CLI and the shared runtime. Существует два скрипта: There are two scripts:
- Скрипт PowerShell, который используется в Windows. A PowerShell script that works on Windows.
- Скрипт bash, который выполняется в Linux и macOS. A bash script that works on Linux/macOS.
.NET собирает данные телеметрии. .NET collects telemetry data. Дополнительные сведения и о том, как отказаться от этого, см. в разделе Телеметрия пакета SDK для .NET. To learn more and how to opt out, see .NET SDK telemetry.
Цель Purpose
Скрипты предназначены для использования в сценариях непрерывной интеграции (CI), если: The intended use of the scripts is for Continuous Integration (CI) scenarios, where:
Пакет SDK должен быть установлен без участия пользователя и без использования прав администратора. The SDK needs to be installed without user interaction and without admin rights.
Установка пакета SDK не обязательно должна выполняться в ходе нескольких выполнений непрерывной интеграции. The SDK installation doesn’t need to persist across multiple CI runs.
Типичная последовательность событий: The typical sequence of events:
- запускается непрерывная интеграция; CI is triggered.
- в ходе непрерывной интеграции устанавливается пакет SDK с помощью одного из этих скриптов; CI installs the SDK using one of these scripts.
- непрерывная интеграция завершается, временные данные, включая установку пакета SDK, удаляются. CI finishes its work and clears temporary data including the SDK installation.
Чтобы настроить среду разработки или запустить приложения, используйте установщики вместо этих скриптов. To set up a development environment or to run apps, use the installers rather than these scripts.
Рекомендуемая версия Recommended version
Мы рекомендуем использовать стабильную версию скриптов. We recommend that you use the stable version of the scripts:
Поведение скрипта Script behavior
Оба скрипта выполняют одни и те же функции. Both scripts have the same behavior. Они скачивают файл ZIP или TAR из места сборки CLI, а затем осуществляют установку в расположении по умолчанию или расположении, заданном параметром -InstallDir|—install-dir . They download the ZIP/tarball file from the CLI build drops and proceed to install it in either the default location or in a location specified by -InstallDir|—install-dir .
По умолчанию скрипты установки скачивают и устанавливают пакет SDK. By default, the installation scripts download the SDK and install it. Если вы хотите получить только общую среду выполнения, укажите аргумент -Runtime|—runtime . If you wish to only obtain the shared runtime, specify the -Runtime|—runtime argument.
По умолчанию скрипт добавляет место установки в переменную $PATH для текущего сеанса. By default, the script adds the install location to the $PATH for the current session. Переопределите это поведение по умолчанию, указав аргумент -NoPath|—no-path . Override this default behavior by specifying the -NoPath|—no-path argument. Скрипт не задает переменную среды DOTNET_ROOT . The script doesn’t set the DOTNET_ROOT environment variable.
Перед запуском скрипта установите все необходимые зависимости. Before running the script, install the required dependencies.
Вы можете установить конкретную версию с помощью аргумента -Version|—version . You can install a specific version using the -Version|—version argument. Версию следует указывать в виде номера из трех частей, например 2.1.0 . The version must be specified as a three-part version number, such as 2.1.0 . Если версия не указана, скрипт устанавливает версию latest . If the version isn’t specified, the script installs the latest version.
Скрипты установки не обновляют реестр в Windows. The install scripts do not update the registry on Windows. Они просто скачивают двоичные ZIP-файлы и копируют их в папку. They just download the zipped binaries and copy them to a folder. Чтобы значения разделов реестра обновлялись, используйте установщики .NET. If you want registry key values to be updated, use the .NET installers.
Параметры Options
-AzureFeed|—azure-feed
Указывает URL-адрес для веб-канала Azure этого установщика. Specifies the URL for the Azure feed to the installer. Изменять это значение не рекомендуется. We recommended that you don’t change this value. Значение по умолчанию — https://dotnetcli.azureedge.net/dotnet . The default value is https://dotnetcli.azureedge.net/dotnet .
-Channel|—channel
Указывает исходный канал для установки. Specifies the source channel for the installation. Допустимые значения: The possible values are:
- Current — самый последний выпуск. Current — Most current release.
- LTS — канал долгосрочной поддержки (самый последний поддерживаемый выпуск). LTS — Long-Term Support channel (most current supported release).
- Версия из двух частей в формате X.Y, который представляет конкретный выпуск (например, 2.1 или 3.0 ). Two-part version in X.Y format representing a specific release (for example, 2.1 or 3.0 ).
- Имя ветви, например release/3.1.1xx или master (для ночных выпусков). Branch name: for example, release/3.1.1xx or master (for nightly releases). Используйте этот параметр для установки версии из канала предварительной версии. Use this option to install a version from a preview channel. Используйте имя канала, указанное в разделе Установщики и двоичные файлы. Use the name of the channel as listed in Installers and Binaries.
Значение по умолчанию — LTS . The default value is LTS . Дополнительные сведения о каналах поддержки .NET см. на странице о политике поддержки .NET. For more information on .NET support channels, see the .NET Support Policy page.
-DryRun|—dry-run
Если задано, скрипт не будет выполнять установку. If set, the script won’t perform the installation. Вместо этого отобразится командная строка для согласованной установки запрошенной в настоящее время версии .NET CLI. Instead, it displays what command line to use to consistently install the currently requested version of the .NET CLI. Например, если указать версию latest , он отображает ссылку для определенной версии, чтобы эту команду можно было детерминировано использовать в скрипте сборки. For example, if you specify version latest , it displays a link with the specific version so that this command can be used deterministically in a build script. Кроме того, он отображает расположение двоичного файла, если вы хотите выполнить скачивание или установку самостоятельно. It also displays the binary’s location if you prefer to install or download it yourself.
-FeedCredential|—feed-credential
Используется в качестве строки запроса для добавления в веб-канал Azure. Used as a query string to append to the Azure feed. Позволяет изменять URL-адрес для использования учетных записей хранилища BLOB-объектов, не являющихся общедоступными. It allows changing the URL to use non-public blob storage accounts.
—help
Выводит справку для скрипта. Prints out help for the script. Применяется только к скрипту bash. Applies only to bash script. Для PowerShell используется Get-Help ./dotnet-install.ps1 . For PowerShell, use Get-Help ./dotnet-install.ps1 .
-InstallDir|—install-dir
Указывает путь установки. Specifies the installation path. Если такого пути нет, создается каталог. The directory is created if it doesn’t exist. Значение по умолчанию — %LocalAppData%\Microsoft\dotnet в Windows и /usr/share/dotnet в Linux и macOS. The default value is %LocalAppData%\Microsoft\dotnet on Windows and /usr/share/dotnet on Linux/macOS. Двоичные файлы помещаются непосредственно в этот каталог. Binaries are placed directly in this directory.
-JSonFile|—jsonfile
Указывает путь к файлу global.json, который будет использоваться для определения версии пакета SDK. Specifies a path to a global.json file that will be used to determine the SDK version. В файле global.json должно быть значение для sdk:version . The global.json file must have a value for sdk:version .
-NoCdn|—no-cdn
Отключает загрузку из сети доставки содержимого Microsoft Azure (CDN) и напрямую использует некэшированный веб-канал. Disables downloading from the Azure Content Delivery Network (CDN) and uses the uncached feed directly.
-NoPath|—no-path
Если значение задано, папка установки не экспортируется в путь текущего сеанса. If set, the installation folder isn’t exported to the path for the current session. По умолчанию скрипт изменит значение PATH, благодаря чему .NET CLI становится доступным сразу после установки. By default, the script modifies the PATH, which makes the .NET CLI available immediately after install.
-ProxyAddress
Если значение задано, установщик использует прокси-сервер для выполнения веб-запросов. If set, the installer uses the proxy when making web requests. (Допустимо только для Windows.) (Only valid for Windows.)
Если задано значение ProxyAddress , предоставляется список URL-адресов, разделенных запятыми, которые будут обходить прокси-сервер. If set with ProxyAddress , provides a list of comma-separated urls that will bypass the proxy. (Допустимо только для Windows.) (Only valid for Windows.)
ProxyUseDefaultCredentials
Если задано, установщик использует учетные данные текущего пользователя при использовании адреса прокси-сервера. If set, the installer uses the credentials of the current user when using proxy address. (Допустимо только для Windows.) (Only valid for Windows.)
-Runtime|—runtime
Устанавливается только общая среда выполнения, а не весь пакет SDK. Installs just the shared runtime, not the entire SDK. Допустимые значения: The possible values are:
- dotnet — общая среда выполнения Microsoft.NETCore.App . dotnet — the Microsoft.NETCore.App shared runtime.
- aspnetcore — общая среда выполнения Microsoft.AspNetCore.App . aspnetcore — the Microsoft.AspNetCore.App shared runtime.
- windowsdesktop — общая среда выполнения Microsoft.WindowsDesktop.App . windowsdesktop — the Microsoft.WindowsDesktop.App shared runtime.
—runtime-id [Не рекомендуется] —runtime-id [Deprecated]
Указывает идентификатор среды выполнения, для которого устанавливаются средства. Specifies the runtime identifier for which the tools are being installed. Используйте значение linux-x64 для переносимых файлов Linux. Use linux-x64 for portable Linux. (Допустимо только для Linux и macOS и для версий более ранних, чем .NET Core 2.1.) (Only valid for Linux/macOS and for versions earlier than .NET Core 2.1.)
—os
Указывает операционную систему, для которой устанавливаются средства. Specifies the operating system for which the tools are being installed. Возможные значения: osx , linux , linux-musl , freebsd , rhel.6 . Possible values are: osx , linux , linux-musl , freebsd , rhel.6 . (Допустимо для .NET Core 2.1 и более поздних версий.) (Valid for .NET Core 2.1 and later.)
Параметр является необязательным и должен использоваться только в том случае, если требуется переопределить операционную систему, обнаруженную сценарием. The parameter is optional and should only be used when it’s required to override the operating system that is detected by the script.
-SharedRuntime|—shared-runtime
Этот параметр является устаревшим и может быть удален в будущей версии скрипта. This parameter is obsolete and may be removed in a future version of the script. Вместо этого рекомендуется использовать параметр -Runtime|—runtime . The recommended alternative is the -Runtime|—runtime option.
Устанавливаются только двоичные файлы общей среды выполнения; в противном случае устанавливается весь пакет SDK. Installs just the shared runtime bits, not the entire SDK. Этот параметр эквивалентен указанию -Runtime|—runtime dotnet . This option is equivalent to specifying -Runtime|—runtime dotnet .
-SkipNonVersionedFiles|—skip-non-versioned-files
Пропускает установку файлов без версии, таких как dotnet.exe, если они уже существуют. Skips installing non-versioned files, such as dotnet.exe, if they already exist.
-UncachedFeed|—uncached-feed
Позволяет изменять URL-адрес некэшированного веб-канала, используемого этим установщиком. Allows changing the URL for the uncached feed used by this installer. Изменять это значение не рекомендуется. We recommended that you don’t change this value.
-Verbose|—verbose
Отображает сведения о диагностике. Displays diagnostics information.
-Version|—version
Представляет определенную версию сборки. Represents a specific build version. Допустимые значения: The possible values are:
- latest — последняя сборка в канале (используется с параметром -Channel ). latest — Latest build on the channel (used with the -Channel option).
- Версия из трех частей в формате X.Y.Z, который представляет определенную версию сборки. Заменяет параметр -Channel . Three-part version in X.Y.Z format representing a specific build version; supersedes the -Channel option. Например, 2.0.0-preview2-006120 . For example: 2.0.0-preview2-006120 .
Если не указано, -Version по умолчанию принимает значение latest . If not specified, -Version defaults to latest .
Примеры Examples
Установка последней версии с долгосрочной поддержкой (LTS) в расположение по умолчанию: Install the latest long-term supported (LTS) version to the default location:
Mac OS и Linux: macOS/Linux:
Установка последней версии из канала версии 3.1 в указанное расположение Install the latest version from 3.1 channel to the specified location:
Mac OS и Linux: macOS/Linux:
Установка общей среды выполнения версии 3.0.0 Install the 3.0.0 version of the shared runtime:
Mac OS и Linux: macOS/Linux:
Получите и установите скрипт версии 2.1.2 за корпоративным прокси-сервером (только для Windows): Obtain script and install the 2.1.2 version behind a corporate proxy (Windows only):
Получите скрипт и установите однострочные примеры для интерфейса командной строки .NET: Obtain script and install .NET CLI one-liner examples: