VS 2017 15.1 中的大型 XML 文件

Large XML Files in VS 2017 15.1

有人告诉我...

'sms-20170225122824.xml' is too large to open with XML editor. The maximum file size is '10' MB. Please update the registry key 'HKCU\Software\Microsoft\VisualStudio.0_65fa8ce7_Config\XmlEditor\MaxFileSizeSupportedByLanguageService' to change the maximum size.

不仅键 15.0_65fa8ce7_Config 不存在,所以我手动创建了它(加上子键)但是 type 是什么 MaxFileSizeSupportedByLanguageService

为什么它还不存在?

在 Visual Studio 2015 年,您可以在 14.0_Config\XmlEditor 中找到类型为字符串 (REG_SZ) 的注册表项 MaxFileSizeSupportedByLanguageService

不确定这是否适用于 VS 2017。根据微软文档: "To deliver on a low-impact install of Visual Studio that also supports side-by-side installs, we no longer save most configuration data to the system registry..."(source)

编辑:查看有关如何更新 Visual Studio 2017 注册表设置的答案:

这是为所有用户完成这项工作的小型 powershell

$vsWherePath = Join-Path ${env:ProgramFiles(x86)} "Microsoft Visual Studio\Installer\vswhere.exe"
$installPath = &$vsWherePath -all -latest -property installationPath
$vsregedit = Join-Path $installPath 'Common7\IDE\vsregedit.exe'
& $VsRegEdit set "$installPath" "HKLM" "XmlEditor" "MaxFileSizeSupportedByLanguageService" string 100

如果用户配置单元中已有设置,您可以删除它们或在用户级别设置值 - 这也不需要管理员权限:

$vsWherePath = Join-Path ${env:ProgramFiles(x86)} "Microsoft Visual Studio\Installer\vswhere.exe"
$installPath = &$vsWherePath -all -latest -property installationPath
$vsregedit = Join-Path $installPath 'Common7\IDE\vsregedit.exe'
& $VsRegEdit set "$installPath" "HKCU" "XmlEditor" "MaxFileSizeSupportedByLanguageService" string 100

在 Visual Studio (Tools -> Command Line -> Developer Command Prompt) 中打开开发人员命令提示符。在命令提示符中键入:

VsRegEdit set local HKLM XmlEditor MaxFileSizeSupportedByLanguageService string 500

(将 500 替换为您想要的任何值,以 MB 为单位)。重启 Visual Studio.