Open JLopez99 opened 3 years ago
Seeing something similar for net9.0:
C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Microsoft\NuGet\17.0\Microsoft.NuGet.targets(198,5): error : Your project does not reference ".NETCoreApp,Version=v9.0" framework. Add a ref
erence to ".NETCoreApp,Version=v9.0" in the "TargetFrameworks" property of your project file and then re-run NuGet restore. [C:\Development\NativeCallManaged\Managed\build\Interop.vcxproj]
Something feels broken here @mjrousos.
CMakeLists:
# Configure the Interop Target
# ----------------------------------------
# ----------------------------------------
add_library(Interop SHARED Source/Interop.cpp)
# Enable C++/CLR support for mixed-mode.
# See: https://learn.microsoft.com/en-us/dotnet/core/porting/cpp-cli
target_compile_options(Interop PRIVATE /clr:netcore)
# Link with the managed target.
target_link_libraries(Interop Managed)
# Make sure to use the latest .NET
set_target_properties(Interop PROPERTIES DOTNET_TARGET_FRAMEWORK "net9.0")
A bit more precision, the build is successful if it's the only target produced by CMake. But there seems to be some kind of collision going on in the \build\obj directory between the C++/CLI target and the C# managed target. It might be more of a build system issue with CMake itself, perhaps, or maybe MSBuild.
Using Visual Studio 2019 (16.10.3) I get this error: