.NET Core SDK 概述.NET Core SDK overview

.NET Core SDK 是一组库和工具,开发人员可用其创建 .NET Core 应用程序和库。The .NET Core SDK is a set of libraries and tools that allow developers to create .NET Core applications and libraries. 它包含以下用于构建和运行应用程序的组件:It contains the following components that are used to build and run applications:

  • .NET Core CLI。The .NET Core CLI.
  • .NET Core 库和运行时。.NET Core libraries and runtime.
  • dotnet 驱动程序The dotnet driver.

获取 .NET Core SDKAcquiring the .NET Core SDK

与任何工具一样,首先应将工具安装到计算机上。As with any tooling, the first thing is to get the tools to your machine. 根据场景,可以使用以下某个方法安装 SDK:Depending on your scenario, you can install the SDK using one of the following methods:

  • 使用本机安装程序。Use the native installers.
  • 使用安装 shell 脚本。Use the installation shell script.

本机安装程序主要用于开发人员的计算机。The native installers are primarily meant for developer's machines. SDK 通过每个受支持平台的本机安装机制进行分发,例如 Ubuntu 上的 DEB 包或 Windows 上的 MSI 程序包。The SDK is distributed using each supported platform's native install mechanism, such as DEB packages on Ubuntu or MSI bundles on Windows. 这些安装程序将根据需要为用户安装并设置环境,以便在安装完成后可立即使用 SDK。These installers install and set up the environment as needed for the user to use the SDK immediately after the install. 但是,这些安装程序也需要对计算机的管理权限。However, they also require administrative privileges on the machine. 可以在 .NET 下载页面上找到要安装的 SDK。You can find the SDK to install on the .NET downloads page.

另一方面,安装脚本不需要使用管理权限。Install scripts, on the other hand, don't require administrative privileges. 但是,它们也不会在计算机上安装任何系统必备组件;需要手动安装所有系统必备组件。However, they also don't install any prerequisites on the machine; you need to install all of the prerequisites manually. 这些脚本主要用于设置生成服务器或希望安装工具但没有管理权限的情况(请务必注意上述系统必备组件注意事项)。The scripts are meant mostly for setting up build servers or when you wish to install the tools without admin privileges (do note the prerequisites caveat above). 可以在安装脚本引用一文中找到详细信息。You can find more information in the install script reference article. 如果对如何在 CI 构建服务器上设置 SDK 感兴趣,请参阅在持续集成 (CI) 中使用 .NET Core SDK 和工具一文。If you're interested in how to set up the SDK on your CI build server, see the Using .NET Core SDK and tools in Continuous Integration (CI) article.

默认情况下,SDK 以“并排”(SxS) 方式安装,这意味着多个版本可以随时在一台计算机上共存。By default, the SDK installs in a "side-by-side" (SxS) manner, which means multiple versions can coexist at any given time on a single machine. 选择要使用的 .NET Core 版本一文中详细说明了如何在运行 CLI 命令时选择版本。How the version gets picked when you're running CLI commands is explained in more detail in the Select the .NET Core version to use article.

请参阅See also