I am trying to create a Visual Studio 2022 solution that contains C# projects, but I’m seeing the failure No CMAKE_CSharp_COMPILER could be found
.
Running the configure step with --trace-redirect
I can see that the C# compiler is found but fails to compile due to
C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\Roslyn\csc.exe /noconfig /nowarn:1701,1702 /fullpaths /nostdlib+ /platform:anycpu32bitpreferred /define:Platformx64;PlatformToolsetv143 /highentropyva+ /nullable:enable /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\mscorlib.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.Core.dll" /debug:pdbonly /out:obj\x64\Debug\CompilerIdCSharp.exe /subsystemversion:6.00 /target:exe /warnaserror+ /utf8output /deterministic+ /langversion:7.3 /analyzerconfig:D:\INVBUILD\wombat-software\.editorconfig /analyzerconfig:D:\INVBUILD\wombat-software\src\.editorconfig CMakeCSharpCompilerId.cs "obj\x64\Debug\.NETFramework,Version=v4.7.2.AssemblyAttributes.cs" /warnaserror+:MSB3270
CSC : error CS8630: Invalid 'nullable' value: 'Enable' for C# 7.3. Please use language version '8.0' or greater.
I am using cmake version 3.29.2
.
Is there a way to influence either the C# language version selection, or whether “nullable” is enabled/disabled during CSharp compiler identification?