如何在 Visual Studio 2022 中获取 MSVC Merge Modules v142?

How to get MSVC MergeModules v142 in VisualStudio 2022?

我使用 v142 工具集开发一个在 VisualStudio 中构建的开源应用程序。选择此工具集而不是较新的 v143 工具集是因为

新开发者当然是从 VisualStudio 2022 CE 开始的。他们只需安装正确的工具集,编译就会按预期成功。但是,当构建安装程序(使用Wix)时,它会抱怨v142 的合并模块不可用:

error LGHT0103 : The system cannot find the file 'C:\Program Files\Microsoft Visual Studio22\Community\VC\Redist\MSVC.29.30133\MergeModules\Microsoft_VC142_CRT_x86.msm'.

即使通过 VisualStudio 安装程序安装包 Microsoft.VisualStudio.Component.VC.Redist.MSM 也没有引入 v142 合并模块。它们仅适用于 v143 工具集。

在此处查找 VS 2022 已安装软件包的完整列表:

{
  "version": "1.0",
  "components": [
    "Microsoft.VisualStudio.Component.CoreEditor",
    "Microsoft.VisualStudio.Workload.CoreEditor",
    "Microsoft.VisualStudio.Component.TypeScript.TSServer",
    "Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions",
    "Microsoft.VisualStudio.Component.JavaScript.TypeScript",
    "Microsoft.VisualStudio.Component.Roslyn.Compiler",
    "Microsoft.Component.MSBuild",
    "Microsoft.VisualStudio.Component.Roslyn.LanguageServices",
    "Microsoft.VisualStudio.Component.TextTemplating",
    "Microsoft.VisualStudio.Component.NuGet",
    "Microsoft.VisualStudio.Component.Debugger.JustInTime",
    "Component.Microsoft.VisualStudio.LiveShare.2022",
    "Microsoft.VisualStudio.Component.IntelliCode",
    "Microsoft.VisualStudio.Component.VC.CoreIde",
    "Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
    "Microsoft.VisualStudio.Component.Graphics.Tools",
    "Microsoft.VisualStudio.Component.VC.DiagnosticTools",
    "Microsoft.VisualStudio.Component.VC.Redist.14.Latest",
    "Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core",
    "Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions.CMake",
    "Microsoft.VisualStudio.Component.VC.CMake.Project",
    "Microsoft.VisualStudio.Component.VC.ATL",
    "Microsoft.VisualStudio.Component.VC.TestAdapterForBoostTest",
    "Microsoft.VisualStudio.Component.VC.TestAdapterForGoogleTest",
    "Microsoft.VisualStudio.Component.VC.ASAN",
    "Microsoft.VisualStudio.Component.Windows10SDK.18362",
    "Microsoft.VisualStudio.ComponentGroup.VC.Tools.142.x86.x64",
    "Microsoft.VisualStudio.Workload.NativeDesktop",
    "Microsoft.VisualStudio.Component.VC.Redist.MSM",
    "Microsoft.VisualStudio.Component.VC.14.29.16.11.x86.x64"
  ]
}

这似乎是 Visual Studio 2022 安装程序中的错误:合并模块组件应该与安装的工具集相关联,但它似乎只安装 latest/current 工具集的合并模块。 Visual Studio2019年也是如此;看来该版本是安装合并模块的唯一方法。

也就是说,merge modules are not recommended. The preferred method is to use the redistributable packages