VS2019 (16.4) 安裝源離線下載,更新,清理,企業版與論壇版重復下載


注意1:已經不能直接在項目屬性的Build -> Advanced按鈕更改C#語言版本,而是使用默認語言版本。
    目標框架                語言版本
    .NET Core 3.x          C# 8
    .NET Core 2.x          C# 7.3
    .NET Standard          C# 7.3
    .NET Framework         C# 7.3
可以手動編輯csproj文件,指定版本,格式:
    <PropertyGroup>
       <LangVersion>preview</LangVersion>
    </PropertyGroup>
其中LangVersion可以是下面之一:
    preview                最新預覽版語法
    latest                 最新版
    latestMajor            最新主版版本(即,不包括次版本)
    8.0
    7.3
    7.2
    7.1
    7
    6
    5
    4
    3
    ISO-2                  ISO/IEC 23270:2006 C# (2.0)語法
    ISO-1                  ISO/IEC 23270:2003 C# (1.0/1.2)語法
----

擴展
Extensions -> Manage Extensions (*建議,**可選,***不建議)
已自帶IntelliCode擴展。
* Edit Project 右鍵項目或者解決方案會出現Edit命令,進行文本編輯
* Git Diff Margin 在代碼編輯器左側添加 Margin 列,用於快捷撤銷代碼的修改
* Line Press 調整行高,在Tools -> Options中設置,建議行高20%,關閉Compress功能
* Favorite Documents 添加收藏菜單Extensions -> Favorites,可以收藏文件
  .gitignore 請排除文件:解決方案名.favdoc
* VSColorOutput 能彩色顯示Output窗口文本,調試輸出時可自動加入時間戳
  建議在Tool -> Options中找到此擴展配置,將Build Actions的屬性全部設置為True
* Visual Studio Spell Checker (VS2017 and Later) 對代碼注釋和字符串進行拼寫檢查
* ReAttach 更方便的附加進程
* Open Command Line 在解決方案管理器右鍵加入打開命令行快捷菜單
* Add Multiple Projects To Solutions 可以將某個目錄中的全部項目一次性添加到解決方案
  右鍵解決方案,添加,Multiple Projects菜單項。
* Add New File 可用來快速添加.gitignore文件,快速創建多級目錄文件,一次多個文件
  右鍵解文件夾,添加,會出現Add Empty Files菜單項。
** Solution Error Visualizer 在解決方案窗口中用波浪線標識出錯的文件
** Versioning Controlled Build 圖形界面批量更改版本號,也支持VC++項目
  會在擴展菜單中添加 VCB 組
** ResXManager 資源多語言管理器,可以同時顯示多語言翻譯在一個界面
** Viasfora 括號顏色擴展,建議VS黑色主題下使用
** Image Optimizer 右鍵PNG/JPEG/GIF出現壓縮圖像命令
*** Line Endings Unifier 統一換行符的擴展(目前對vs2019支持不好)
  建議用.editorconfig文件代替,然后用Run Code Cleanup來清理代碼
  清理全部解決方案:Analyze -> Code Cleanup中的命令。
  建立.editorconfig的方法,右鍵解決方案 ->Add Item...,搜索 editorconfig,
  可以選擇(.NET)那個,下面是補充了 root = true 和 end_of_line = crlf


=============
.editorconfig
-------------
root = true
# All files 
[*] 
indent_style = space 
# Code files 
[*.{cs,csx,vb,vbx}] 
indent_size = 4 
insert_final_newline = true 
charset = utf-8-bom 
end_of_line = crlf
=============

關閉VS后會出現安裝擴展窗口,點Modify安裝好后再啟動VS

字體
FiraCode
https://github.com/tonsky/FiraCode
choco install -y firacode

字體和括號高亮配置
Tool -> Options,搜索font進入Environment/Font and color選項頁
* 將Text Editor的Font選擇:Fira Code Retina,字號9
* 在Display Items列表中找到Brace Matching(中文:大括號匹配):
background會為選中的括號增加背景,VS白色背景主題可以選擇黃色,深色背景可以選擇綠色
* 在選項頁最上面的“顯示其設置”里選擇“[全部文本工具窗口]”
  將Text Editor的Font選擇:Fira Code Retina,字號8


-----------------
安裝器下載
https://www.visualstudio.com/thank-you-downloading-visual-studio/?sku=Community&rel=16#
https://www.visualstudio.com/thank-you-downloading-visual-studio/?sku=Professional&rel=16#
https://www.visualstudio.com/thank-you-downloading-visual-studio/?sku=Enterprise&rel=16#

離線安裝文件
vs_community.exe --layout "D:\vs2019community" --lang zh-CN en-US --includeRecommended --add Microsoft.VisualStudio.Workload.CoreEditor Microsoft.VisualStudio.Workload.Azure Microsoft.VisualStudio.Workload.Data Microsoft.VisualStudio.Workload.ManagedDesktop Microsoft.VisualStudio.Workload.NativeCrossPlat Microsoft.VisualStudio.Workload.NativeDesktop Microsoft.VisualStudio.Workload.NetCoreTools Microsoft.VisualStudio.Workload.NetCrossPlat Microsoft.VisualStudio.Workload.NetWeb Microsoft.VisualStudio.Workload.Node Microsoft.VisualStudio.Workload.Universal Microsoft.VisualStudio.Workload.Python
不包括:Microsoft.VisualStudio.Workload.DataScience Microsoft.VisualStudio.Workload.ManagedGame Microsoft.VisualStudio.Workload.NativeGame Microsoft.VisualStudio.Workload.NativeMobile Microsoft.VisualStudio.Workload.Office Microsoft.VisualStudio.Workload.VisualStudioExtension
清理離線文件
vs_community.exe --layout D:\vs2019community --clean D:\vs2019community\Archive\GUID\Catalog.json

安裝(自動)
D:\vs2019community\vs_setup.exe --passive --norestart --noWeb --noUpdateInstaller --path cache="D:\VS2019\cache" --path shared="D:\VS2019\shared" --path install="D:\VS2019\Community"
這里的--path install等價於后面的--installPath,默認的安裝位置是:"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community"
可以指定--productKey xxxxx-xxxxx-xxxxx-xxxxx-xxxxx安裝序列號

更新(自動)
D:\vs2019community\vs_setup.exe update --passive --norestart --noWeb --installPath "D:\VS2019\Community"

修改(手動)
D:\vs2019community\vs_setup.exe modify --norestart --noWeb --installPath "D:\VS2019\Community"


其他命令
robocopy /MIR D:\vs2019community D:\vs2019professional
robocopy /MIR D:\vs2019community D:\vs2019enterprise
刪除新目錄下的所有文件(非文件夾),然后運行對應的離線命令。
通過ScanInvalidFolders_VS2017(https://github.com/m2nlight/ScanInvalidFolders_VS2017/releases)工具掃描無效的文件,
然后刪除他們:
C:\> for /f "tokens=*" %a in ('scaninvalidfolders.exe -d D:\vs2019community -q') do rd /s /q "D:\vs2019community\%a"

其他離線下載
vs_professional.exe --layout "D:\vs2019professional" --lang zh-CN en-US --includeRecommended --add Microsoft.VisualStudio.Workload.CoreEditor Microsoft.VisualStudio.Workload.Azure Microsoft.VisualStudio.Workload.Data Microsoft.VisualStudio.Workload.ManagedDesktop Microsoft.VisualStudio.Workload.NativeCrossPlat Microsoft.VisualStudio.Workload.NativeDesktop Microsoft.VisualStudio.Workload.NetCoreTools Microsoft.VisualStudio.Workload.NetCrossPlat Microsoft.VisualStudio.Workload.NetWeb Microsoft.VisualStudio.Workload.Node Microsoft.VisualStudio.Workload.Universal Microsoft.VisualStudio.Workload.Python

vs_enterprise.exe --layout "D:\vs2019enterprise" --lang zh-CN en-US --includeRecommended --add Microsoft.VisualStudio.Workload.CoreEditor Microsoft.VisualStudio.Workload.Azure Microsoft.VisualStudio.Workload.Data Microsoft.VisualStudio.Workload.ManagedDesktop Microsoft.VisualStudio.Workload.NativeCrossPlat Microsoft.VisualStudio.Workload.NativeDesktop Microsoft.VisualStudio.Workload.NetCoreTools Microsoft.VisualStudio.Workload.NetCrossPlat Microsoft.VisualStudio.Workload.NetWeb Microsoft.VisualStudio.Workload.Node Microsoft.VisualStudio.Workload.Universal Microsoft.VisualStudio.Workload.Python

鏈接
釋放日志
https://docs.microsoft.com/visualstudio/releases/2019/release-notes
企業版組件ID
https://docs.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-enterprise?view=vs-2019
全部組件ID
https://docs.microsoft.com/en-us/visualstudio/install/workload-and-component-ids?view=vs-2019
命令行
https://docs.microsoft.com/en-us/visualstudio/install/use-command-line-parameters-to-install-visual-studio?view=vs-2019

-------
在選項窗口中(Tools -> Options菜單命令),Environment -> International Settings可更改語言為簡體中文。

如果安裝失敗,可嘗試多次執行下面命令清理安裝和緩存:
"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\Resources\app\layout\InstallCleanup.exe" -f
注意,-f等於-full,會清除系統中的VS2019;可以指定-i清理instance,或者-c清理cache。

然后刪除程序目錄
rd /s /q "D:\VS2019"

刪除安裝命令中的--passive參數,進入交互安裝模式。

-------
Visual Studio 2019 將在以下操作系統上安裝並運行(建議 64 位):
Windows 10 版本 1703 或更高版本:家庭版、專業版、教育版和企業版(不支持 LTSC 和 Windows 10 S)
Windows Server 2019:Standard 和 Datacenter
Windows Server 2016:Standard 和 Datacenter
Windows 8.1(帶有更新 2919355):核心板、專業版和企業版
Windows Server 2012 R2(更新 2919355):Essentials、Standard、Datacenter
Windows 7 SP1(帶有最新的 Windows 更新):家庭高級版、專業版、企業版、旗艦版

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM