当前位置: 首页 > news >正文

Visual Studio 2026 离线安装完整指南


一、准备工作(在有网的机器上)

1. 下载引导程序

从微软官网下载vs_Community.exe(社区版)或对应版本。

2. 创建离线布局包

以管理员身份运行 CMD,执行以下命令(确保 D 盘有40GB 以上可用空间):

vs_Community.exe --layout "D:\visual_studio_2026_offline" --add Microsoft.VisualStudio.Workload.ManagedDesktop --add Microsoft.VisualStudio.Workload.NetWeb --add Microsoft.VisualStudio.Workload.Data --add Microsoft.VisualStudio.Component.Git --add Microsoft.VisualStudio.Component.ClassDesigner --add Microsoft.VisualStudio.Component.VisualStudioData --add Microsoft.NetCore.Component.SDK --add Microsoft.Net.Component.4.8.SDK --add Microsoft.NetCore.Component.Runtime.6.0 --add Microsoft.NetCore.Component.Runtime.8.0 --includeRecommended --lang zh-CN --useLatestInstaller

下载时间较长,取决于网速,通常需要 1~3 小时。

3. 下载新版代码签名证书(关键步骤)

VS 2026 的安装包使用了2024 年新版代码签名证书,离线机器上默认没有此证书,必须提前下载。

在有网的机器上,管理员 PowerShell 执行:

Invoke-WebRequest-Uri"http://www.microsoft.com/pkiops/certs/Microsoft%20Windows%20Code%20Signing%20PCA%202024.crt"-OutFile"D:\CodeSignPCA2024.crt"

注意:使用http而非https


二、传输文件到目标机器

将以下内容复制到 U 盘或移动硬盘,带到目标机器:

  • D:\visual_studio_2026_offline\(整个文件夹)
  • D:\CodeSignPCA2024.crt(新版代码签名证书)

三、在目标机器上安装(完全无网环境)

第一步:安装证书(必须最先执行)

以管理员身份运行 CMD,依次执行:

:: 安装新版代码签名中间证书(最关键) certutil.exe -addstore -f "CA" "D:\CodeSignPCA2024.crt" :: 安装离线包自带的根证书 certutil.exe -addstore -f "Root" "D:\visual_studio_2026_offline\certificates\manifestRootCertificate.cer" certutil.exe -addstore -f "Root" "D:\visual_studio_2026_offline\certificates\manifestCounterSignRootCertificate.cer" certutil.exe -addstore -f "Root" "D:\visual_studio_2026_offline\certificates\vs_installer_opc.RootCertificate.cer"

每条命令执行后应看到:CertUtil: -addstore 命令成功完成

第二步:首次运行引导程序(安装 VS Installer)

vs_Community.exe --noweb --layoutPath "D:\visual_studio_2026_offline" --add Microsoft.VisualStudio.Workload.ManagedDesktop --add Microsoft.VisualStudio.Workload.NetWeb --add Microsoft.VisualStudio.Workload.Data --add Microsoft.VisualStudio.Component.Git --add Microsoft.VisualStudio.Component.ClassDesigner --add Microsoft.VisualStudio.Component.VisualStudioData --add Microsoft.NetCore.Component.SDK --add Microsoft.Net.Component.4.8.SDK --add Microsoft.NetCore.Component.Runtime.6.0 --add Microsoft.NetCore.Component.Runtime.8.0 --includeRecommended --locale zh-CN

此步骤会将 VS Installer 安装到C:\Program Files (x86)\Microsoft Visual Studio\Installer\

第三步:使用 setup.exe 正式安装 VS

"C:\Program Files (x86)\Microsoft Visual Studio\Installer\setup.exe" install --layoutPath "D:\visual_studio_2026_offline" --noWeb --add Microsoft.VisualStudio.Workload.ManagedDesktop --add Microsoft.VisualStudio.Workload.NetWeb --add Microsoft.VisualStudio.Workload.Data --add Microsoft.VisualStudio.Component.Git --add Microsoft.VisualStudio.Component.ClassDesigner --add Microsoft.VisualStudio.Component.VisualStudioData --add Microsoft.NetCore.Component.SDK --add Microsoft.Net.Component.4.8.SDK --add Microsoft.NetCore.Component.Runtime.6.0 --add Microsoft.NetCore.Component.Runtime.8.0 --includeRecommended --locale zh-CN --in "D:\visual_studio_2026_offline\Response.json"

--in Response.json会自动读取 productId 和 channelId,无需手动填写


四、常见错误排查

查看日志

安装失败时,日志文件位于:

%TEMP%\dd_bootstrapper_*.log %TEMP%\dd_installer_*.log %TEMP%\dd_vs_Community_decompression_log.txt

错误一:证书验证失败(最常见)

错误信息:

Certificate is invalid: D:\visual_studio_2026_offline\vs_installer.opc Error 0x80131509: Signature verification failed

原因:目标机器缺少 Microsoft Windows Code Signing PCA 2024 中间证书。

解决:按照第三节第一步,安装所有证书,然后重试。

验证证书是否正确:用 PowerShell 查看vs_installer.opc的签名信息:

Copy-Item"D:\visual_studio_2026_offline\vs_installer.opc""D:\vs_installer_opc.zip"Expand-Archive"D:\vs_installer_opc.zip"-DestinationPath"D:\vs_installer_opc_extracted"-Force

解压后找到签名 XML,查看Issuer字段确认证书颁发机构。


错误二:选项"lang"未知

错误信息:

你的参数包含多个错误。第一个错误: 选项"lang"未知

原因:新版安装程序不支持--lang参数。

解决:--lang zh-CN改为--locale zh-CN


错误三:layoutPath 多次定义

错误信息:

多次定义了选项"layoutPath"

原因:直接运行vs_Community.exe时,bootstrapper 内部会自动追加一次--layoutPath,导致重复。

解决:改为直接调用setup.exe(见第三节第三步),而不是vs_Community.exe


错误四:productId / channelId 不知道填什么

解决:查看离线包中的Response.json

type "D:\visual_studio_2026_offline\Response.json"

VS 2026 社区版的正确值为:

  • productId:Microsoft.VisualStudio.Product.Community
  • channelId:VisualStudio.18.Release

或者直接使用--in Response.json参数让安装程序自动读取,无需手动填写。


五、组件说明

组件 ID说明
Microsoft.VisualStudio.Workload.ManagedDesktop.NET 桌面开发
Microsoft.VisualStudio.Workload.NetWebASP.NET 和 Web 开发
Microsoft.VisualStudio.Workload.Data数据存储和处理
Microsoft.VisualStudio.Component.GitGit 版本控制
Microsoft.VisualStudio.Component.ClassDesigner类设计器
Microsoft.VisualStudio.Component.VisualStudioData数据源和服务引用
Microsoft.NetCore.Component.SDK.NET SDK 核心工具链
Microsoft.Net.Component.4.8.SDK.NET Framework 4.8 SDK
Microsoft.NetCore.Component.Runtime.6.0.NET 6 运行时
Microsoft.NetCore.Component.Runtime.8.0.NET 8 运行时

六、系统要求

项目要求
操作系统Windows 10 1703 以上 / Windows 11
磁盘空间布局包约 40GB,安装后约 20~30GB
内存至少 4GB(推荐 8GB)
权限必须以管理员身份运行所有命令

七、注意事项

  • 所有 CMD / PowerShell 命令必须以管理员身份运行
  • 命令中不要出现 Markdown 格式(如[文字](链接)),直接写组件 ID
  • --skipCertificateCheck参数无法绕过.opc包的核心签名验证,不要依赖此参数
  • 离线包内的certificates文件夹中的证书仅包含旧版根证书,VS 2026 还额外需要 2024 年新版中间证书
http://www.jsqmd.com/news/723814/

相关文章:

  • SLIME方法:大语言模型对齐的新范式解析
  • 数字示波器长记录分析技术及Wave Inspector应用
  • python pre-commit
  • ThinkPad风扇控制3步搞定:TPFanCtrl2让你的笔记本告别“飞机起飞“噪音
  • **生物计算新范式:用Python实现DNA序列的并行编码与解码系统**
  • C/C++中组合详解及其作用介绍
  • 我做了一款鸿蒙加密App,加密后的密文看起来像一段正常中文——聊聊 AES-GCM + 字谱替换的实现思路
  • PHP医疗系统脱敏性能断崖式下跌真相(AES-CTR误用、盐值硬编码、熵池枯竭三大致命缺陷)
  • lvgl_v8之按键实现滚动区域滚动代码示例(亲测好用)
  • 如何5秒获取百度网盘提取码:baidupankey智能工具完整指南
  • 前端性能优化:图片优化策略详解
  • 别再只用Excel了!教你用Streamlit把销售数据变成可分享的Web应用
  • 2026 年 TikTok 电商 AI 视频工具实测手记:一个跨境卖家的选型复盘
  • 告别字体模糊:MacType让Windows文字显示如macOS般清晰锐利
  • 如何用SQL快速获取上个月的对比数据_LAG函数应用
  • 开源AI智能体评估指南:从基准测试到技术选型实战
  • 005、位置、速度、加速度与加加速度
  • ​fluent没有破解成功出现的错误提示——hit return to exit-成功破解即可解决问题​
  • RAPIDS 25.06版本GPU加速数据科学新特性解析
  • C++中指针和引用的区别
  • 通俗数学4-虚光子的数学拟合
  • c++primer类详解
  • 播客内容创作4个核心技巧,帮你稳定产出高质量吸粉内容
  • ARM MPAMSM_EL1寄存器解析与资源隔离技术
  • Prompt工程的反模式:那些让你的AI应用变差的常见错误
  • Oracle 数据库启动失败:ORA-29701、ORA-01565、ORA-17503 故障处理记录_20260429
  • 睡眠编译优化:软件测试从业者的专业效能提升指南
  • 跟着 MDN 学 HTML day_1:(全套原生Input+表单结构拆解)
  • 前端性能优化:JavaScript 性能优化详解
  • 房产看房记录口碑推荐|经筛选优质实用选择整理分享