简体   繁体   English

CMake 没有 CSharp 编译器可以在 docker 图像中找到

[英]CMake no CSharp compiler can be found inside docker image

I'm trying to build a docker image to setup CI/CD for a project of my organization.我正在尝试构建 docker 映像来为我组织的项目设置 CI/CD。 The project is mostly Windows C++ (MFC), but has some components in C#.该项目主要是Windows C++(MFC),但在C#中有一些组件。

Storically the projects were all managed by hand but I'm in the process of migrating to CMake and automate the build process.从历史上看,这些项目都是手工管理的,但我正在迁移到 CMake 并自动化构建过程。

Locally everything works fine but when building on the CI/CD server, CMake says that No CMAKE_CSharp_COMPILER could be found .本地一切正常,但在 CI/CD 服务器上构建时,CMake 说No CMAKE_CSharp_COMPILER could be found

The docker image I'm building is based on mcr.microsoft.com/windows/servercore:ltsc2019 and I installed, using the Visual Studio Build Tools installer, the following workloads:我正在构建的 docker 映像基于mcr.microsoft.com/windows/servercore:ltsc2019并且我使用 Visual Studio Build Tools 安装程序安装了以下工作负载:

  • Microsoft.VisualStudio.Workload.MSBuildTools
  • Microsoft.VisualStudio.Workload.ManagedDesktopBuildTools
  • Microsoft.VisualStudio.Workload.VCTools
  • Microsoft.VisualStudio.Component.Windows10SDK.17763

I can provide the full Dockerfile if necessary.如有必要,我可以提供完整的Dockerfile

Anyway, testing the built image I can find both msbuild and csc compilers, CMake can't.无论如何,测试构建的图像我可以找到msbuildcsc编译器,CMake 不能。

Any idea on what could be the problem?关于可能是什么问题的任何想法?

Looks like I was missing a Visual Studio component, specifically Microsoft.Net.Component.4.TargetingPack .看起来我缺少一个 Visual Studio 组件,特别是Microsoft.Net.Component.4.TargetingPack

To detect the correct C# compiler, CMake compiles a little source code.为了检测正确的 C# 编译器,CMake 编译了一些源代码。 This compilation targets .NET Framework v4, which I was missing.这个编译的目标是 .NET Framework v4,我错过了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM