建立 Visual Studio 的離線安裝Create an offline installation of Visual Studio

我們已設計 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.

Visual Studio 2019 的設計適用於各種網路和電腦組態。We designed Visual Studio 2019 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.

例如,您可能有不可靠網際網路連線,或具有低頻寬的連線。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 部署至已啟用網際網路防火牆的用戶端工作站網路,請參閱建立 Visual Studio 的網路安裝安裝 Visual Studio 離線安裝所需憑證頁面。If you are an enterprise administrator who wants to perform a deployment of Visual Studio to a network of client workstations that are firewalled from the internet, see our Create a network installation of Visual Studio and Install certificates required for Visual Studio offline installation pages.

使用 [全部下載後安裝] 功能Use the "Download all, then install" feature

15.8 版的新功能:在您下載 Web 安裝程式之後,請從 Visual Studio 安裝程式中選取新的 [全部下載後安裝] 選項。New in version 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.

[全部下載後安裝] 選項

在您下載 Web 安裝程式之後,請從 Visual Studio 安裝程式中選取新的 [全部下載後安裝] 選項。After you download the web installer, select the new Download all, then install option from the Visual Studio Installer. 然後,繼續執行您的安裝。Then, continue with your installation.

[全部下載後安裝] 選項

我們設計了 [全部下載後安裝] 功能,讓您能夠針對下載 Visual Studio 的同一部電腦將 Visual Studio 下載成單一安裝。We designed the "Download all, then install" feature so that you can download Visual Studio as a single installation for the same computer on which you downloaded it. 如此一來,您便可以放心地先中斷與 Web 的連線,再安裝 Visual Studio。That way, you can safely disconnect from the web before you install Visual Studio.

Important

請勿使用 [全部下載後安裝] 功能來建立要傳輸至另一部電腦的離線快取。Do not use the "Download all, then install" feature to create an offline cache that you intend to transfer to another computer. 此功能並不是設計來進行該用途。It's not designed to work that way.

如果您想要建立離線快取,將 Visual Studio 安裝在另一部電腦上,請參閱本頁面的使用命令列建立本機快取一節,以了解如何建立本機快取,或參閱建立 Visual Studio 的網路安裝頁面,以了解如何建立網路快取。If you want to create an offline cache to install Visual Studio on another computer, see the Use the command line to create a local cache section of this page for information about how to create a local cache, or the Create a network installation of Visual Studio page for information about how to create a network cache.

使用命令列來建立本機快取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 StudioThen, 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

您必須具有網際網路連線才能完成此步驟。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 CommunityVisual 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
版本Edition 檔案File
Visual Studio CommunityVisual 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

您必須具有網際網路連線才能完成此步驟。You must have an internet connection to complete this step.

Important

如果您安裝的是 Visual Studio Community,則必須在安裝 30 天內啟用它。If you install Visual Studio Community, you must activate it within 30 days of installation. 這需要網際網路連線。This requires an internet connection.

開啟命令提示字元,然後使用下列範例中的其中一個命令。Open a command prompt and use one of the commands from the following examples. 這裡所列的範例假設您使用 Visual Studio Community Edition;請根據您的版本適當地調整命令。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.

Tip

為了防止發生錯誤,請確保完整安裝路徑少於 80 個字元。To prevent an error, make sure that your full installation path is less than 80 characters.

  • 針對 .NET Web 和 .NET 桌面開發,請執行:For .NET web and .NET desktop development, run:

      vs_community.exe --layout c:\vslayout --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:\vslayout --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:\vslayout --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:\vslayout --lang en-US
    

Note

完整的 Visual Studio 配置至少需要 35 GB 磁碟空間。A complete Visual Studio layout requires a minimum of 35 GB of disk space. 如需詳細資訊,請參閱系統需求For more information, see System requirements. 如需如何建立只包含您要安裝之元件的配置資訊,請參閱使用命令列參數安裝 Visual StudioAnd for information about how to create a layout with only the components you want to install, see Use command-line parameters to install Visual Studio.

Note

完整的 Visual Studio 配置至少需要 35 GB 磁碟空間。A complete Visual Studio layout requires a minimum of 35 GB of disk space. 如需詳細資訊,請參閱系統需求For more information, see System requirements. 如需如何建立只包含您要安裝之元件的配置資訊,請參閱使用命令列參數安裝 Visual StudioAnd for information about how to create a layout with only the components you want to install, see Use command-line parameters to install Visual Studio.

如果您想要安裝英文以外的語言,請將 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.

步驟 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. 但如果您在安裝期間選取不存在於快取中的元件,則安裝程式會嘗試從網際網路下載它們。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:\vslayout --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:\vslayout\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 LanguageLanguage
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 安裝和升級問題進行疑難排解,以取得逐步指導方針。If your Visual Studio installation fails, see Troubleshoot Visual Studio 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