<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none"><!-- p { margin-top: 0px; margin-bottom: 0px; }--></style>
</head>
<body dir="ltr" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p><span style="font-size: 12pt;">All,</span></p>
<div dir="ltr" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
<div>
<p>Thank you in advance,<br>
</p>
<p><br>
</p>
<p>I'm an experienced CMake user, in the C++ realm. I'm presently working outside that realm, porting a 200-project solution from Visual Studio (.vcxproj, .csproj) files to CMake. I'm very pleased that CMake has adopted CSharp! Thank you!<br>
</p>
<p><br>
</p>
<p>I seem to have uncovered a bug where one CSharp project depends on another.<br>
</p>
<p><br>
</p>
<p>The first CMakeLists.txt:<br>
</p>
<div>cmake_minimum_required(VERSION 3.12)<br>
</div>
<div>project(DockPanel CSharp)</div>
<div>...<br>
<div>add_library(DockPanel MODULE ${SOURCES_files_Compile} ${SOURCES_files_EmbeddedResource})<br>
</div>
<div>
<div>set_property(TARGET DockPanel APPEND PROPERTY VS_DOTNET_REFERENCES "System")<br>
</div>
<div><br>
</div>
<br>
The second CMakeLists.txt:<br>
</div>
<div>
<div>cmake_minimum_required(VERSION 3.12)<br>
</div>
<div>project(CSharpFramework CSharp)</div>
<div>...</div>
<div>
<div>add_library(CSharpFramework MODULE ${SOURCES_files_Compile} ${SOURCES_files_EmbeddedResource})</div>
<div>
<div>target_link_libraries(CSharpFramework PUBLIC <span style="font-size:12pt">$<$<CONFIG:Debug>:DockPanel></span><span style="font-size:12pt"> </span><span style="font-size:12pt">)</span></div>
<div>
<div>set_property(TARGET CSharpFramework APPEND PROPERTY VS_DOTNET_REFERENCES "System")</div>
<div><br>
</div>
(I haven't shown everything, as I'm extracting these from a huge system, but I can elaborate if necessary...)</div>
<div><br>
</div>
<div>CMake configures and generates (to VS2015) without error. Things proceed as expected until it's time to link the second project.</div>
<div>Then, I get:<br>
..\DockPanel\Debug\DockPanel.dll : fatal error LNK1107: invalid or corrupt file: cannot read at 0x358<br>
<br>
</div>
A bit of investigative work shows that the generated CSharpFramework.vcxproj contains, as expected:<br>
<div> <ProjectReference Include="D:\Havok\hk2014_2_5_Simulation\Source\build-x64-msvc-v140-\Vision\Editor\vForge\DockPanel\DockPanel.vcxproj"></div>
<div> <Project>{DCCB7EE9-726F-3D42-A673-D6CCB4EF6675}</Project></div>
<div> <Name>DockPanel</Name><br>
</div>
<div> </ProjectReference><br>
</div>
<div><br>
</div>
<div>But, it also contains:<br>
<div> <Link></div>
<div> <AdditionalDependencies>..\DockPanel\Release\DockPanel.dll; ...</AdditionalDependencies><br>
</div>
<div> ...<br>
</div>
<div> <span style="font-size:12pt"> </Link></span></div>
<div><br>
</div>
<div>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 expected the generated .vcxproj to contain only the ProjectReference section for DockPanel, and not
include it in AdditionalDependencies.<br>
</div>
</div>
<div><br>
</div>
<div>Can you confirm that this is a bug?<br>
</div>
<div><br>
</div>
<div>Thank you,<br>
</div>
<div>Phil<br>
</div>
<div><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>