VS: ReferenceOutputAssembly has the wrong value for include_external_msproject C# targets referenced from C++/CLI projects
We generate a Visual Studio 19 solution with CMake.
Unfortunately it looks like !3778 (merged) missed a case: We generate a C++/CLI project with CMake that references a C# .csproj
imported via include_external_msproject
. The C# project of course generates an output dll that we want referenced from the C++/CLI project. But CMake sets ReferenceOutputAssembly
to false
in the vcxproj
file generated for the C++/CLI target. This is incorrect.
The problematic output is here: https://gitlab.kitware.com/cmake/cmake/blob/c7c17c5f74632d0a0a10d8560050bafa46045a61/Source/cmVisualStudio10TargetGenerator.cxx#L4123
It calls cmGeneratorTarget::GetManagedType, where I guess the root of this bug can be found. Obviously A C# .csproj
is managed, but include_external_msproject
defines a UTILITY
target and GetManagedType
aways returns ManagedType::Undefined
for UTILITY
targets, which causes ReferenceOutputAssembly
to be set to false.
This bug was already reported in this comment, but was apparently never turned into an issue.