Merge topic 'vs-sdk-style-platform-override'

4ebedf246d VS: Fix SLNs for DOTNET_SDK targets with VS_GLOBAL_PlatformTarget

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Steven Boswell <ulatekh@yahoo.com>
Merge-request: !11247
This commit is contained in:
Brad King
2025-09-30 13:56:43 +00:00
committed by Kitware Robot
6 changed files with 82 additions and 6 deletions
+13 -6
View File
@@ -1009,12 +1009,19 @@ cm::VS::Solution cmGlobalVisualStudioGenerator::CreateSolution(
project->TypeId = Solution::Project::TypeIdDefault;
}
project->Platform =
// On VS 19 and above, always map .NET SDK projects to "Any CPU".
(gt->IsDotNetSdkTarget() && this->Version >= VSVersion::VS16 &&
!cmGlobalVisualStudioGenerator::IsReservedTarget(gt->GetName()))
? "Any CPU"
: solution.Platform;
if (gt->IsDotNetSdkTarget() &&
!cmGlobalVisualStudioGenerator::IsReservedTarget(gt->GetName())) {
cmValue platformTarget = gt->GetProperty("VS_GLOBAL_PlatformTarget");
if (!platformTarget.IsEmpty()) {
project->Platform = *platformTarget;
} else {
project->Platform =
// On VS 16 and above, always map .NET SDK projects to "Any CPU".
this->Version >= VSVersion::VS16 ? "Any CPU" : solution.Platform;
}
} else {
project->Platform = solution.Platform;
}
// Add solution-level dependencies.
TargetDependSet const& depends = this->GetTargetDirectDepends(gt);