使用 2015 C++ 构建时,MSBuild 使用错误的 cl.exe v140 平台工具包
我们目前正在为我们的一些项目创建构建环境。 特别是,我们使用 VC++ 6.0 和 VS2019 来构建其中一些项目。
当在 VS2019 中构建 C++ 项目并将 Platform Toolkit 设置为 C++ 2015 v140 时,MSBuild 尝试使用 VC++ 6.0 编译器来构建项目。如果我将工具包切换到任何其他版本,它会使用正确的 cl.exe 进行构建。
如果我从路径环境变量中删除包含 cl.exe 的 VC98 文件夹,我会在 VS2019 中收到 cl.exe 无法找到错误。 所以我认为有一些东西针对 VC6.0 cl.exe 对 2015 工具包进行了硬编码。
我尝试在 VS 安装程序中安装和重新安装附加组件,但没有成功。 VS2019的修复也没有解决。 我已经尝试了 2013 年以来的所有版本的 Visual Studio,同样的问题。 这看起来像是 MSBuild 问题,它位于错误的位置。 是否有地方可以查看 MSBuild 中工具包的映射?我在注册表中看不到太多内容。
我构建时的输出显示如下,该版本显然是一个非常旧的编译器(VC6.0):
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86
We're currently making a build environment for some of our projects.
In particular we're using VC++ 6.0 and VS2019 to build some of these projects.
When building our C++ project in VS2019 with the Platform Toolkit set to C++ 2015 v140, MSBuild attempts to use the VC++ 6.0 compiler to build the project. If I switch the Toolkit to any other version it builds with the correct cl.exe.
If I remove the VC98 folder that contains cl.exe from the path environment variable I get a cl.exe can't be found error in VS2019.
So I think there's something hardcoding the 2015 toolkit against the VC6.0 cl.exe.
I've tried installing and reinstalling the additional components in the VS Installer but no luck.
Repair of VS2019 didn't fix it either.
I've tried all versions of Visual Studio back to 2013 same issue.
This looks like an MSBuild issue, it's in the wrong location.
Is there any place where I can view the mapping for the toolkits in MSBuild? I couldn't see much in the registry.
The output when I build shows the following, the version is clearly a very old compiler (the VC6.0 one):
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论