I'm trying to build a docker image to setup CI/CD for a project of my organization. The project is mostly Windows C++ (MFC), but has some components in C#.
Storically the projects were all managed by hand but I'm in the process of migrating to CMake and automate the build process.
Locally everything works fine but when building on the CI/CD server, CMake says that 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:
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.
Anyway, testing the built image I can find both msbuild
and csc
compilers, CMake can't.
Any idea on what could be the problem?
Looks like I was missing a Visual Studio component, specifically Microsoft.Net.Component.4.TargetingPack
.
To detect the correct C# compiler, CMake compiles a little source code. This compilation targets .NET Framework v4, which I was missing.