Project referring to CSharp project generates incorrectly?
I seem to have uncovered a bug where one CSharp project depends on another.
The first CMakeLists.txt:
cmake_minimum_required(VERSION 3.12)
project(DockPanel CSharp)
...
add_library(DockPanel MODULE ${SOURCES_files_Compile} ${SOURCES_files_EmbeddedResource})
set_property(TARGET DockPanel APPEND PROPERTY VS_DOTNET_REFERENCES "System")
The second CMakeLists.txt:
cmake_minimum_required(VERSION 3.12)
project(CSharpFramework CSharp)
...
add_library(CSharpFramework MODULE ${SOURCES_files_Compile} ${SOURCES_files_EmbeddedResource})
target_link_libraries(CSharpFramework PUBLIC $<$<CONFIG:Debug>:DockPanel> )
set_property(TARGET CSharpFramework APPEND PROPERTY VS_DOTNET_REFERENCES "System")
(I haven't shown everything, as I'm extracting these from a huge system, but I can elaborate if necessary...)
CMake configures and generates (to VS2015) without error. Things proceed as expected until it's time to link the second project. Then, I get:
..\DockPanel\Debug\DockPanel.dll : fatal error LNK1107: invalid or corrupt file: cannot read at 0x358
A bit of investigative work shows that the generated CSharpFramework.vcxproj contains, as expected:
<ProjectReference Include="D:\Havok\hk2014_2_5_Simulation\Source\build-x64-msvc-v140-\Vision\Editor\vForge\DockPanel\DockPanel.vcxproj">
<Project>{DCCB7EE9-726F-3D42-A673-D6CCB4EF6675}</Project>
<Name>DockPanel</Name>
</ProjectReference>
But, it also contains:
<Link>
<AdditionalDependencies>..\DockPanel\Release\DockPanel.dll; ...</AdditionalDependencies>
...
</Link>
The inclusion of DockPanel.dll in the AdditionalDependencies section is, I believe, causing Visual Studio to try to open it as a '.lib', and failing.
I expect the generated .vcxproj to contain only the ProjectReference section for DockPanel, and not include it in AdditionalDependencies.