cia1099 / offlineInstallVS2019

離線安裝Visual Studio方法

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

離線安裝VS2019

建立下載離線包

  1. 首先用cmd移至vs_community.exe所在資料夾以便執行
  2. 相關的參數命令可以參考使用命令列參數安裝 Visual Studio
  3. 使用--add參數命令加入所要下載的元件,元件識別碼請參照Visual Studio 工作負載和元件識別碼,其中Community 2019的元件目錄
  4. e.g.(開啟cmd輸入以下,假設本機存在: D:\Download\vs_community__477180316.1572016098.exe)
cd D:\Download
vs_community__477180316.1572016098.exe --layout D:\Download\vslayout ^
--add Microsoft.VisualStudio.Workload.NativeDesktop ^
--add Microsoft.VisualStudio.Workload.NativeCrossPlat ^
--add Microsoft.VisualStudio.Component.VC.CMake.Project ^
--add Microsoft.VisualStudio.Component.VC.Llvm.Clang ^
--add Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset ^
--add Microsoft.VisualStudio.Workload.ManagedDesktop ^
--addProductLang zh-CN ^
--addProductLang zh-TW ^
--addProductLang en-US ^
--includeRecommended --lang zh-CN zh-TW en-US

註解: --layout表示要將離線安裝包下載至的路徑 語言參數可參照語言地區設定清單

安裝離線安裝包

  1. 開啟cmd移動至離線安裝包路徑,執行以下命令:保險起見,最好用管理員身分啟動cmd
cd D:\Download\vslayout
vs_community__477180316.1572016098.exe --installPath "D:\Program_Files\Microsoft Visual Studio\2019\Community" ^
--add Microsoft.VisualStudio.Workload.NativeDesktop ^
--add Microsoft.VisualStudio.Workload.NativeCrossPlat ^
--add Microsoft.VisualStudio.Component.VC.CMake.Project ^
--add Microsoft.VisualStudio.Component.VC.Llvm.Clang ^
--add Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset ^
--add Microsoft.VisualStudio.Workload.ManagedDesktop ^
--includeRecommended --noWeb --nocache

註解: --installPath設定所要安裝的路徑

以上命令失敗了,直接在離線包目錄下執行vs_setup.exe執行安裝

--noWeb安裝程式會使用版面配置目錄中的檔案來安裝 Visual Studio。 如果使用者嘗試安裝不在版面配置中的元件,安裝程式會失敗。

--includeRecommended包含所安裝之任何工作負載的建議元件,但不包含選擇性元件。

--nocache套件會在安裝或修復之後刪除。

可以加上以下命令參數來執行安裝,具體參閱使用命令列參數安裝 Visual Studio

--passive --norestart 不顯示互動式提示,但會顯示進度

  • 使用命令列更新 Visual Studio 執行個體,不顯示互動式提示,但顯示進度
vs_community__477180316.1572016098.exe --update --quiet --wait
vs_community__477180316.1572016098.exe update --wait --passive --norestart ^
--installPath "D:\Program_Files\Microsoft Visual Studio\2019\Community" ^
--add Microsoft.VisualStudio.Workload.NativeDesktop ^
--add Microsoft.VisualStudio.Workload.NativeCrossPlat ^
--add Microsoft.VisualStudio.Component.VC.CMake.Project ^
--add Microsoft.VisualStudio.Component.VC.Llvm.Clang ^
--add Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset ^
--includeRecommended --nocache
注意

兩個命令都是必要的。 第一個命令更新 Visual Studio 安裝程式。 第二個命令更新 Visual Studio 執行個體。 若要避免 [使用者帳戶控制] 對話方塊,請以系統管理員身分執行命令提示字元。

About

離線安裝Visual Studio方法