创建 Visual Studio 2017 脱机安装缓存Create an offline installation of Visual Studio 2017

Visual Studio 2017 经过精心设计,可在各种网络和计算机配置中良好运行。We designed Visual Studio 2017 to work well in a variety of network and computer configurations. 虽然我们建议你试用 Visual Studio Web 安装程序—这是一个小巧文件,可及时提供最新修补程序和功能—但我们知道对你而言这也许并不可行。While we recommend that you try the Visual Studio web installer—which is a small file and allows you to stay current with all the latest fixes and features—we understand that you might not be able to.

例如,你的 Internet 连接不可靠或带宽较低。For example, you might have an unreliable internet connection or one that has low bandwidth. 如果是这样,可选择:在安装之前使用新的“全部下载后再安装”功能下载文件,或使用命令行创建文件的本地缓存。If so, you have a few options: You can use the new "Download all, then install" feature to download the files before you install, or you can use the command line to create a local cache of the files.

Note

如果你是企业管理员,并且要将 Visual Studio 2017 部署到客户端工作站网络(与 Internet 之间设有防火墙),请参阅创建 Visual Studio 2017 的网络安装安装 Visual Studio 脱机安装所需的证书页。If you are an enterprise administrator who wants to perform a deployment of Visual Studio 2017 to a network of client workstations that are firewalled from the internet, see our Create a network installation of Visual Studio 2017 and Install certificates required for Visual Studio offline installation pages.

使用“全部下载,然后安装”功能Use the "Download all, then install" feature

15.8 中的新增功能:下载 Web 安装程序后,从 Visual Studio 安装程序中选择新的“全部下载后再安装”选项********。New in 15.8: After you download the web installer, select the new Download all, then install option from the Visual Studio Installer. 然后,继续安装。Then, continue with your installation.

“全部下载后再安装”选项

使用命令行创建本地缓存Use the command line to create a local cache

下载小型引导程序后,使用命令行创建本地缓存。After you download a small bootstrapper, use the command line to create a local cache. 然后,使用本地缓存安装 Visual Studio。Then, use the local cache to install Visual Studio. (此过程替换了以前版本中可用的 ISO 文件。)(This process replaces the ISO files that were available for previous versions.)

操作方法如下。Here's how.

步骤 1 - 下载 Visual Studio 引导程序Step 1 - Download the Visual Studio bootstrapper

必须具有 Internet 连接才能完成此步骤。You must have an internet connection to complete this step.

首先,下载选定 Visual Studio 版本的 Visual Studio 引导程序。Start by downloading the Visual Studio bootstrapper for your chosen edition of Visual Studio. 安装程序文件—或引导程序—将是以下项之一,或与之类似。Your setup file—or bootstrapper—will match or be similar to one of the following.

版本Edition 文件File
Visual Studio 社区Visual Studio Community vs_community.exevs_community.exe
Visual Studio ProfessionalVisual Studio Professional vs_professional.exevs_professional.exe
Visual Studio EnterpriseVisual Studio Enterprise vs_enterprise.exevs_enterprise.exe

步骤 2 - 创建本地安装缓存Step 2 - Create a local install cache

必须具有 Internet 连接才能完成此步骤。You must have an internet connection to complete this step.

请打开命令提示符,并使用以下示例中的任一命令。Open a command prompt and use one of the commands from the following examples. 此处列出的示例假定用户使用的是 Visual Studio 社区版;请根据版本相应调整命令。The examples that are listed here assume that you're using the Community edition of Visual Studio; adjust the command as appropriate for your edition.

  • 对于 .NET Web 和.NET 桌面开发,请运行:For .NET web and .NET desktop development, run:

    vs_community.exe --layout c:\vs2017layout --add Microsoft.VisualStudio.Workload.ManagedDesktop --add Microsoft.VisualStudio.Workload.NetWeb --add Component.GitHub.VisualStudio --includeOptional --lang en-US

  • 对于 .NET 桌面和 Office 开发,请运行:For .NET desktop and Office development, run:

    vs_community.exe --layout c:\vs2017layout --add Microsoft.VisualStudio.Workload.ManagedDesktop --add Microsoft.VisualStudio.Workload.Office --includeOptional --lang en-US

  • 对于 C++ 桌面开发,请运行:For C++ desktop development, run:

    vs_community.exe --layout c:\vs2017layout --add Microsoft.VisualStudio.Workload.NativeDesktop --includeRecommended --lang en-US

  • 若要创建包含所有功能的完整本地布局(耗时将很长 — 我们提供的功能_非常多_!),请运行:To create a complete local layout with all features (this will take a long time—we have lots of features!), run:

    vs_community.exe --layout c:\vs2017layout --lang en-US

如果要安装非英语语言,请从语言区域设置列表中将 en-US 更改为区域设置。If you want to install a language other than English, change en-US to a locale from the List of language locales. 然后,使用此可用组件和工作负载列表,进一步自定义安装缓存。Then, use the list of the components and workloads available to further customize your installation cache.

Important

完整的 Visual Studio 2017 布局至少需要 35 GB 磁盘空间,可能需要一段时间才能下载完成。A complete Visual Studio 2017 layout requires at least 35 GB of disk space and can take some time to download. 有关如何创建仅具有要安装的组件的布局的信息,请参阅使用命令行参数安装 Visual Studio 2017See Use command-line parameters to install Visual Studio 2017 for information on how to create a layout with only the components you want to install.

步骤 3 - 从本地缓存安装 Visual StudioStep 3 - Install Visual Studio from the local cache

Tip

当你从本地安装缓存运行时,安装程序会使用其中每个文件的本地版本。When you run from a local install cache, setup uses the local versions of each of these files. 不过,如果在安装过程中选择的组件不在缓存中,安装程序会尝试从 Internet 下载它们。But if you select components during installation that aren't in the cache, setup attempts to download them from the internet.

若要确保仅安装先前下载的文件,请使用在创建布局缓存时所用的相同命令行选项。To make sure that you install only the files that you've previously downloaded, use the same command-line options that you used to create the layout cache. 例如,如果使用以下命令创建了布局缓存:For example, if you created a layout cache with the following command:

vs_community.exe --layout c:\vs2017layout --add Microsoft.VisualStudio.Workload.ManagedDesktop --add Microsoft.VisualStudio.Workload.NetWeb --add Component.GitHub.VisualStudio --includeOptional --lang en-US

然后使用此命令运行安装:Then use this command to run the installation:

c:\vs2017layout\vs_community.exe --add Microsoft.VisualStudio.Workload.ManagedDesktop --add Microsoft.VisualStudio.Workload.NetWeb --add Component.GitHub.VisualStudio --includeOptional

Note

如果你遇到签名无效的错误,则必须安装更新的证书。If you get an error that a signature is invalid, you must install updated certificates. 在脱机缓存中打开证书文件夹。Open the Certificates folder in your offline cache. 双击每个证书文件,然后单击完成证书管理器向导。Double-click each of the certificate files, and then click through the Certificate Manager wizard. 如果要求输入密码,请将密码留空。If you're asked for a password, leave it blank.

语言区域设置列表List of language locales

语言-区域设置Language-locale 语言Language
cs-CZcs-CZ 捷克语Czech
de-DEde-DE 德语German
en-USen-US 英语English
es-ESes-ES 西班牙语Spanish
fr-FRfr-FR 法语French
it-ITit-IT 意大利语Italian
ja-JPja-JP 日语Japanese
ko-KRko-KR 朝鲜语Korean
pl-PLpl-PL 波兰语Polish
pt-BRpt-BR 葡萄牙语 - 巴西Portuguese - Brazil
ru-RUru-RU 俄语Russian
tr-TRtr-TR 土耳其语Turkish
zh-CNzh-CN 中文 - 简体Chinese - Simplified
zh-TWzh-TW 中文 - 繁体Chinese - Traditional

获取支持Get support

有时,你难免遇到一些问题。Sometimes, things can go wrong. 如果 Visual Studio 安装失败,请参阅 Visual Studio 2017 安装和升级问题疑难解答获取分步指南。If your Visual Studio installation fails, see Troubleshooting Visual Studio 2017 installation and upgrade issues for step-by-step guidance.

对于安装相关问题,我们还提供实时聊天(仅限英语)支持选项。We also offer a live chat (English only) support option for installation-related issues.

下面是另外几个支持选项:Here are a few more support options:

请参阅See also