安装了C++使用VS构建工具,但是可以找到Cl.exe

发布于 2025-02-07 02:00:16 字数 934 浏览 2 评论 0 原文

我们有一个基于 docker pull mcr.microsoft.com/dotnet/framework/sdk:4.8

docker文件的一部分用于容器的其他工作负载,

vs_buildtools.exe --quiet --wait --norestart --nocache modify \
--installPath "%ProgramFiles(x86)%\Microsoft Visual Studio\2022\BuildTools" \
--add Microsoft.VisualStudio.Workload.VCTools \
--add Microsoft.VisualStudio.Workload.DataBuildTools \
--add Microsoft.VisualStudio.Workload.UniversalBuildTools

但C ++项目的构建失败, 我们有一个基于 docker pull mcr.microsoft.com/dotnet/framework/sdk:4.8 构建docker文件的一部分说他们找不到cl.exe。

我已经搜索过这个问题,每个有错误的人都说找不到Cl.exe获得了仅运行 vsvars.bats.bat 的答案,并为他们修复了它。但是cl.exe 实际上不存在 。我们转到C:\ Program Files(X86)\ Microsoft Visual Studio \ 2022 \ buildTools \ VC \ tools \ MSVC \ 14.31.31103,没有bin文件夹。
我们在整个容器中搜索了Cl.exe,并在某些C:\ Windows \ winsxs \文件夹中看到了它,我们尝试将其添加到路径环境中,但是它与Windows版本不兼容它的错误。

是否有某种原因无法安装实际的编译器?

We have a Jenkins build agent based on docker pull mcr.microsoft.com/dotnet/framework/sdk:4.8

Part of the Docker file for the container pulls in additional workloads as follows

vs_buildtools.exe --quiet --wait --norestart --nocache modify \
--installPath "%ProgramFiles(x86)%\Microsoft Visual Studio\2022\BuildTools" \
--add Microsoft.VisualStudio.Workload.VCTools \
--add Microsoft.VisualStudio.Workload.DataBuildTools \
--add Microsoft.VisualStudio.Workload.UniversalBuildTools

But builds of C++ projects fail saying they can't find CL.EXE.

I've Googled this problem and everybody who's had errors saying they couldn't find CL.EXE got the answer to just run vsvars.bat and that fixed it for them. But the CL.exe is physically not there. We go to C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.31.31103 and there is no bin folder.
We searched the whole container for cl.exe and do see it in some c:\windows\WinSxS\ folder, and we tried adding that to the PATH environment, but it got an error about it not being compatible with the version of Windows.

Is there some reason it won't install the actual compiler?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

清醇 2025-02-14 02:00:16

您还需要传递 - includeRecommended - 添加microsoft.visualstudio.component.vc.tools.x86.x64 作为参数。

MSVC V143 -VS 2022 C ++ X64/X86构建工具(最新)
vctools Workload包含的组件 推荐
因此,默认情况下,未使用 microsoft.visualstudio.workload.vctools 安装。

这是的描述 - 添加参数来自

在安装或修改命令中,此可重复参数
指定要添加的一个或多个工作负载或组件ID。
安装了工件所需的组件,但不是
推荐或可选组件。您可以控制其他
使用全球组件 - Incressecommonded 和/或
- includeottional 参数。

You also need to pass either --includeRecommended or --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 as an argument.

MSVC v143 - VS 2022 C++ x64/x86 build tools (Latest) is listed among
Components included by VCTools workload as Recommended
and thus is not installed with Microsoft.VisualStudio.Workload.VCTools by default.

Here's the description of the --add parameter from VS Installer command-line parameter reference:

During an install or modify command, this repeatable parameter
specifies one or more workload or component IDs to add.
The required components of the artifact are installed, but not the
recommended or optional components. You can control additional
components globally using --includeRecommended and/or
--includeOptional parameters.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文