如何在 Visual Studio 中安装 (v142) 构建工具 [英] How to install (v142) Build tools in Visual studio

查看:708
本文介绍了如何在 Visual Studio 中安装 (v142) 构建工具的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试在 Visual Studio 中构建某些东西时,Visual Studio 会向我显示一些警告,然后如果我忽略它并构建,则会发生错误.

As I am trying to build something in visual studio then visual studio show me some warning and then If i ignored it and build then error occurs.

    error MSB8020: The build tools for v142 (Platform Toolset = 'v142') 
    cannot be found. To build using the v142 build tools, please install 
    v142 build tools.

它还会向我显示一个备用选项,我也尝试过但不起作用.

It will also show me an Alternate option I also tried it but not works.

    Alternatively, you may upgrade to the current 
    Visual Studio tools by selecting the Project menu or right-click the 
    solution, and then selecting "Retarget solution".

推荐答案

最重要的是,您需要安装 Visual Studio 2019 才能访问 v142 工具.

The bottom line is that you need to install Visual Studio 2019 to access the v142 tools.

随着 Visual Studio 的不同版本(VS2015、VS2017、VS2019),微软还发布了不同的构建工具版本,因为它们继续改进编译器并提供额外的功能并满足更新的语言标准(C++、C++11、C++ 17 等).请参阅 Visual Studio 2015 未检测到 v141 (2017) 构建工具

Along with different versions of Visual Studio (VS2015, VS2017, VS2019), Microsoft also releases different build tool versions as they continue to improve the compiler and provide additional capabilities and to meet updated language standards (C++, C++11, C++17, etc.). See Visual Studio 2015 not detecting v141 (2017) Build tools

另请参阅这篇关于 VS2017 构建工具和从 VS2015 访问旧 v140 的 Microsoft 博客文章,Visual Studio 构建工具现在包括 VS2017 和 VS2015 MSVC 工具集.

See as well this Microsoft blog posting about build tools for VS2017 and accessing the older v140 from VS2015, Visual Studio Build Tools now include the VS2017 and VS2015 MSVC Toolsets.

许多人告诉我们,您仍然需要 MSVC v140 工具集从 Visual Studio 2015 继续构建旧代码库.我们已经更新了 Visual Studio 构建工具以包含来自的 v140 工具集Visual Studio 2015 Update 3 包括最新的服务发布.您可能会注意到编译器工具集构建版本可能与完整 VS 2015 安装中的版本不匹配,即使它们是相同的编译器.发生这种情况是因为我们构建了完整的 VisualStudio 和 Visual Studio 构建工具在不同的分支中,可能在不同的日子建造.

Many of you have told us that you still need the MSVC v140 toolset from Visual Studio 2015 to continue building older codebases. We’ve updated the Visual Studio Build Tools to include the v140 toolset from Visual Studio 2015 Update 3 including the most recent servicing release. You might notice that the compiler toolset build version may not match the version in a full VS 2015 install, even though they are the same compilers. That happens because we build the full Visual Studio and the Visual Studio Build Tools in separate branches that may be built on different days.

Visual Studio 构建工具中的 Visual C++ 构建工具工作负载默认会从 VS2017 安装最新的 v141 工具集.v140VS2015 的工具集将与 v141 工具集并行安装.要安装它们,只需选择VC++ 2015.3 v140 桌面工具集"(x86,x64)"在可选"部分的底部.

The Visual C++ build tools workload in the Visual Studio Build Tools will install the latest v141 toolset from VS2017 by default. The v140 toolset from VS2015 will install side-by-side with the v141 toolset. To install them just select the "VC++ 2015.3 v140 toolset for desktop (x86,x64)" at the bottom of the "Optional" section.

在您的情况下,V142 构建工具是随 VS2019 发布的.VS2017 似乎没有 v142 可用.VS2017 的最新构建工具看起来是 v141.

In your case, V142 build tools was released with VS2019. It does not appear that v142 is available for VS2017. The most recent build tools for VS2017 looks to be v141.

您可以使用 Visual Studio 安装程序通过在列表中添加或删除来修改可用的构建工具.此 SO 帖子描述了一个类似的问题,但在 VS2015 Visual Studio 安装中缺少 v140.MSbuild 错误:构建工具找不到 v140(平台工具集 = 'v140')

You can use the Visual Studio installer to modify the build tools available by adding or removing from the list. This SO posting describes a similar problem but with v140 missing in a VS2015 Visual Studio installation. MSbuild Error: The builds tools for v140 (Platform Toolset = 'v140') cannot be found

但是,如果 Microsoft 没有为您正在使用的 Visual Studio 发布特定的构建工具版本,则它不会显示在可用工具集列表中.

However if Microsoft has not released a particular Build Tools version for the Visual Studio you are using then it will not show in the list of available toolsets.

看起来从 VS2015 开始,Microsoft 提供了一个标准的 Visual Studio 引擎,该引擎在 VS 2015、VS2017 和 VS2019 之间共享,其中构建工具和各种组件正在更新,以提供新的特性和功能以及新的语言标准合规性.Visual Studio 版本与 Visual Studio 版本可以使用的构建工具和组件之间存在依赖关系,例如v142 不适用于 VS2017,很可能是为了激励购买更新的产品.

It looks like beginning with VS2015, Microsoft is providing a standard Visual Studio engine that is shared among VS 2015, VS2017, and VS2019 with build tools and various components being updated to provide new features and functionality and new language standards compliance. There are dependencies between the Visual Studio version and what build tools and components can be used with the Visual Studio version, e.g. v142 is not available for VS2017, most probably to provide an incentive for purchasing the newer product.

关于安装 VS2019 后安装 VS2017

附带说明一下,在对这个问题进行一些发现时,我发现一些文章表明,如果您安装了最近的 Visual Studio,然后安装了早期版本的 Visual Studio,则默认目标构建工具可以也更改为早期安装的构建工具.

As a side note, while doing a bit of discovery on this question, I have found some articles that indicate that if you have a recent Visual Studio installed and then install an earlier version of Visual Studio, the default target build tools can also change to the build tools for the earlier install.

换句话说,如果您已经安装了默认目标为 v142 的 VS2019,然后安装 VS2017,则默认目标将更改为 v141,要求您在使用 VS2019 时将构建目标实际设置为 v142.

In other words, if you have VS2019 with a default target of v142 already installed and then install VS2017, the default target will change to v141 requiring you to actually set the build target to v142 when using VS2019.

这篇关于如何在 Visual Studio 中安装 (v142) 构建工具的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆