mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-11 08:20:18 -06:00
VS: Fix SLNX generation so CSharp projects build in the IDE
Add an explicit solution-level per-project `Platform` for `.csproj` projects even if it is the same as the solution-wide `Platform`. Otherwise the VS IDE skips building it. Fixes: #27330
This commit is contained in:
@@ -331,7 +331,10 @@ void WriteSlnxProject(cmXMLElement& xmlParent, Solution const& solution,
|
||||
.Attribute("Solution", cmStrCat(solution.Configs[i], "|*"));
|
||||
}
|
||||
}
|
||||
if (project.Platform != solution.Platform) {
|
||||
if (project.Platform != solution.Platform ||
|
||||
// C# projects do not build interactively in the VS IDE unless they
|
||||
// have an explicit platform, even if it matches the SLN platform.
|
||||
project.TypeId == Solution::Project::TypeIdCSharp) {
|
||||
cmXMLElement(xmlProject, "Platform")
|
||||
.Attribute("Project", project.Platform);
|
||||
}
|
||||
|
||||
@@ -19,5 +19,6 @@ RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/VsDotnetSdkTargetPlatform.slnx"
|
||||
<Project Path="ZERO_CHECK\.vcxproj" Id="[0-9a-f-]+"/>
|
||||
<Project Path="foo\.csproj" Id="[0-9a-f-]+">
|
||||
<BuildDependency Project="ZERO_CHECK\.vcxproj"/>
|
||||
<Platform Project="[^"]+"/>
|
||||
</Project>
|
||||
</Solution>$]])
|
||||
|
||||
@@ -26,6 +26,7 @@ RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/AutoType.slnx" [[
|
||||
<Project Path="ZERO_CHECK\.vcxproj" Id="[0-9a-f-]+"/>
|
||||
<Project Path="external\.csproj" Id="[0-9a-f-]+">
|
||||
<BuildDependency Project="ZERO_CHECK.vcxproj"/>
|
||||
<Platform Project="[^"]+"/>
|
||||
</Project>
|
||||
<Project Path="external\.dbproj" Id="[0-9a-f-]+">
|
||||
<BuildDependency Project="ZERO_CHECK.vcxproj"/>
|
||||
|
||||
Reference in New Issue
Block a user