From 00db01ddcd0b06f0cf5ddc43c19aa239d769c53f Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 19 Jan 2026 15:47:58 -0500 Subject: Tests: Fix RunCMake.include_external_msproject .sln check failure Accumulate failures instead of only considering the last case. --- .../include_external_msproject/check_utils.cmake | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/Tests/RunCMake/include_external_msproject/check_utils.cmake b/Tests/RunCMake/include_external_msproject/check_utils.cmake index 0162519..4b9658a 100644 --- a/Tests/RunCMake/include_external_msproject/check_utils.cmake +++ b/Tests/RunCMake/include_external_msproject/check_utils.cmake @@ -90,8 +90,6 @@ endfunction() # RunCMake test check helper function(check_project test name guid type platform imported_release_config_name) set(sln "${RunCMake_TEST_BINARY_DIR}/${test}.sln") - set(sep "") - set(failed "") if(NOT type) set(type 8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942) endif() @@ -112,27 +110,23 @@ function(check_project test name guid type platform imported_release_config_name if(guid) check_project_guid("${sln}" "${name}" "${guid}" passed_guid) if(NOT passed_guid) - string(APPEND failed "${sep}${name} solution has no project with expected GUID=${guid}") - set(sep "\n") + string(APPEND RunCMake_TEST_FAILED "${name} solution has no project with expected GUID=${guid}\n") endif() else() set(passed_guid 1) endif() check_project_type("${sln}" "${name}" "${type}" passed_type) if(NOT passed_type) - string(APPEND failed "${sep}${name} solution has no project with expected TYPE=${type}") - set(sep "\n") + string(APPEND RunCMake_TEST_FAILED "${name} solution has no project with expected TYPE=${type}\n") endif() check_custom_platform("${sln}" "${name}" "${platform}" passed_platform) if(NOT passed_platform) - string(APPEND failed "${sep}${name} solution has no project with expected PLATFORM=${platform}") - set(sep "\n") + string(APPEND RunCMake_TEST_FAILED "${name} solution has no project with expected PLATFORM=${platform}\n") endif() check_custom_configuration("${sln}" "${name}" "Release" "${imported_release_config_name}" passed_configuration) if(NOT passed_configuration) - string(APPEND failed "${sep}${name} solution has no project with expected CONFIG=${imported_release_config_name}") - set(sep "\n") + string(APPEND RunCMake_TEST_FAILED "${name} solution has no project with expected CONFIG=${imported_release_config_name}\n") endif() - set(RunCMake_TEST_FAILED "${failed}" PARENT_SCOPE) + set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE) endfunction() -- cgit v0.12 From ab2ef244bd226bd484125cf3fc74a63b202175ce Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 19 Jan 2026 14:15:44 -0500 Subject: VS: Add include_external_msproject detection of `.njsproj` type It is a NodeJS Project. --- Source/cmGlobalVisualStudioGenerator.cxx | 3 +++ Source/cmVSSolution.cxx | 2 ++ Source/cmVSSolution.h | 1 + Tests/RunCMake/include_external_msproject/AutoType-check-sln.cmake | 1 + Tests/RunCMake/include_external_msproject/AutoType-check-slnx.cmake | 4 ++++ Tests/RunCMake/include_external_msproject/AutoType.cmake | 1 + 6 files changed, 12 insertions(+) diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 84f036d..6105ee5 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -798,6 +798,9 @@ cm::string_view cmGlobalVisualStudioGenerator::ExternalProjectTypeId( if (extension == ".dbproj"_s) { return Solution::Project::TypeIdDatabase; } + if (extension == ".njsproj"_s) { + return Solution::Project::TypeIdNodeJS; + } if (extension == ".wapproj"_s) { return Solution::Project::TypeIdWinAppPkg; } diff --git a/Source/cmVSSolution.cxx b/Source/cmVSSolution.cxx index cc75b8a..dc6630f 100644 --- a/Source/cmVSSolution.cxx +++ b/Source/cmVSSolution.cxx @@ -27,6 +27,8 @@ cm::string_view const Solution::Project::TypeIdFSharp = "F2A71F9B-5D33-465A-A702-920D77279786"_s; cm::string_view const Solution::Project::TypeIdFortran = "6989167D-11E4-40FE-8C1A-2192A86A7E90"_s; +cm::string_view const Solution::Project::TypeIdNodeJS = + "9092AA53-FB77-4645-B42D-1CCCA6BD08BD"_s; cm::string_view const Solution::Project::TypeIdPython = "888888A0-9F3D-457C-B088-3A5042F75D52"_s; cm::string_view const Solution::Project::TypeIdVDProj = diff --git a/Source/cmVSSolution.h b/Source/cmVSSolution.h index 5d6b306..4117ecc 100644 --- a/Source/cmVSSolution.h +++ b/Source/cmVSSolution.h @@ -75,6 +75,7 @@ struct Solution final static cm::string_view const TypeIdDefault; static cm::string_view const TypeIdFSharp; static cm::string_view const TypeIdFortran; + static cm::string_view const TypeIdNodeJS; static cm::string_view const TypeIdPython; static cm::string_view const TypeIdVDProj; static cm::string_view const TypeIdVisualBasic; diff --git a/Tests/RunCMake/include_external_msproject/AutoType-check-sln.cmake b/Tests/RunCMake/include_external_msproject/AutoType-check-sln.cmake index 070f62b..22b2c4e 100644 --- a/Tests/RunCMake/include_external_msproject/AutoType-check-sln.cmake +++ b/Tests/RunCMake/include_external_msproject/AutoType-check-sln.cmake @@ -1,6 +1,7 @@ check_project(AutoType externalCS "" "FAE04EC0-301F-11D3-BF4B-00C04F79EFBC" "" "") check_project(AutoType externalDB "" "C8D11400-126E-41CD-887F-60BD40844F9E" "" "") check_project(AutoType externalFS "" "F2A71F9B-5D33-465A-A702-920D77279786" "" "") +check_project(AutoType externalNJS "" "9092AA53-FB77-4645-B42D-1CCCA6BD08BD" "" "") check_project(AutoType externalPy "" "888888A0-9F3D-457C-B088-3A5042F75D52" "" "") check_project(AutoType externalVB "" "F184B08F-C81C-45F6-A57F-5ABD9991F28F" "" "") check_project(AutoType externalVD "" "54435603-DBB4-11D2-8724-00A0C9A8B90C" "" "") diff --git a/Tests/RunCMake/include_external_msproject/AutoType-check-slnx.cmake b/Tests/RunCMake/include_external_msproject/AutoType-check-slnx.cmake index de43352..a065ee8 100644 --- a/Tests/RunCMake/include_external_msproject/AutoType-check-slnx.cmake +++ b/Tests/RunCMake/include_external_msproject/AutoType-check-slnx.cmake @@ -13,6 +13,7 @@ RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/AutoType.slnx" [[ + @@ -35,6 +36,9 @@ RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/AutoType.slnx" [[ + + + diff --git a/Tests/RunCMake/include_external_msproject/AutoType.cmake b/Tests/RunCMake/include_external_msproject/AutoType.cmake index 0ab0be7..c994a5e 100644 --- a/Tests/RunCMake/include_external_msproject/AutoType.cmake +++ b/Tests/RunCMake/include_external_msproject/AutoType.cmake @@ -2,6 +2,7 @@ include_external_msproject(externalCS external.csproj) include_external_msproject(externalDB external.dbproj) include_external_msproject(externalFS external.fsproj) include_external_msproject(externalPy external.pyproj) +include_external_msproject(externalNJS external.njsproj) include_external_msproject(externalVB external.vbproj) include_external_msproject(externalVD external.vdproj) include_external_msproject(externalVF external.vfproj) -- cgit v0.12 From 7ce91857927a5eca9d116c146e1c6f11610a3fb9 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 19 Jan 2026 14:17:24 -0500 Subject: VS: Add include_external_msproject GUIDs for more project types Issue: #27524 --- Source/cmVSSolution.cxx | 12 ++++++ Source/cmVSSolution.h | 6 +++ .../ProjType-check-sln.cmake | 6 +++ .../ProjType-check-slnx.cmake | 43 ++++++++++++++++++++++ .../ProjType-check.cmake | 1 + .../include_external_msproject/ProjType.cmake | 6 +++ .../include_external_msproject/RunCMakeTest.cmake | 2 + 7 files changed, 76 insertions(+) create mode 100644 Tests/RunCMake/include_external_msproject/ProjType-check-sln.cmake create mode 100644 Tests/RunCMake/include_external_msproject/ProjType-check-slnx.cmake create mode 100644 Tests/RunCMake/include_external_msproject/ProjType-check.cmake create mode 100644 Tests/RunCMake/include_external_msproject/ProjType.cmake diff --git a/Source/cmVSSolution.cxx b/Source/cmVSSolution.cxx index dc6630f..cb2b259 100644 --- a/Source/cmVSSolution.cxx +++ b/Source/cmVSSolution.cxx @@ -17,24 +17,36 @@ namespace cm { namespace VS { +cm::string_view const Solution::Project::TypeIdAspNetCore = + "8BB2217D-0F2D-49D1-97BC-3654ED321F3B"_s; cm::string_view const Solution::Project::TypeIdCSharp = "FAE04EC0-301F-11D3-BF4B-00C04F79EFBC"_s; cm::string_view const Solution::Project::TypeIdDatabase = "C8D11400-126E-41CD-887F-60BD40844F9E"_s; cm::string_view const Solution::Project::TypeIdDefault = "8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942"_s; +cm::string_view const Solution::Project::TypeIdDotNetCore = + "9A19103F-16F7-4668-BE54-9A1E7A4F7556"_s; cm::string_view const Solution::Project::TypeIdFSharp = "F2A71F9B-5D33-465A-A702-920D77279786"_s; cm::string_view const Solution::Project::TypeIdFortran = "6989167D-11E4-40FE-8C1A-2192A86A7E90"_s; +cm::string_view const Solution::Project::TypeIdJScript = + "262852C6-CD72-467D-83FE-5EEB1973A190"_s; +cm::string_view const Solution::Project::TypeIdMisc = + "66A2671D-8FB5-11D2-AA7E-00C04F688DDE"_s; cm::string_view const Solution::Project::TypeIdNodeJS = "9092AA53-FB77-4645-B42D-1CCCA6BD08BD"_s; cm::string_view const Solution::Project::TypeIdPython = "888888A0-9F3D-457C-B088-3A5042F75D52"_s; +cm::string_view const Solution::Project::TypeIdSqlSrv = + "00D1A9C2-B5F0-4AF3-8072-F6C62B433612"_s; cm::string_view const Solution::Project::TypeIdVDProj = "54435603-DBB4-11D2-8724-00A0C9A8B90C"_s; cm::string_view const Solution::Project::TypeIdVisualBasic = "F184B08F-C81C-45F6-A57F-5ABD9991F28F"_s; +cm::string_view const Solution::Project::TypeIdWebSite = + "E24C65DC-7377-472B-9ABA-BC803B73C61A"_s; cm::string_view const Solution::Project::TypeIdWinAppPkg = "C7167F0D-BC9F-4E6E-AFE1-012C56B48DB5"_s; cm::string_view const Solution::Project::TypeIdWiX = diff --git a/Source/cmVSSolution.h b/Source/cmVSSolution.h index 4117ecc..49385da 100644 --- a/Source/cmVSSolution.h +++ b/Source/cmVSSolution.h @@ -70,15 +70,21 @@ struct Solution final std::vector BuildDependencies; // Project type GUIDs used during creation. + static cm::string_view const TypeIdAspNetCore; static cm::string_view const TypeIdCSharp; static cm::string_view const TypeIdDatabase; static cm::string_view const TypeIdDefault; + static cm::string_view const TypeIdDotNetCore; static cm::string_view const TypeIdFSharp; static cm::string_view const TypeIdFortran; + static cm::string_view const TypeIdJScript; + static cm::string_view const TypeIdMisc; static cm::string_view const TypeIdNodeJS; static cm::string_view const TypeIdPython; + static cm::string_view const TypeIdSqlSrv; static cm::string_view const TypeIdVDProj; static cm::string_view const TypeIdVisualBasic; + static cm::string_view const TypeIdWebSite; static cm::string_view const TypeIdWinAppPkg; static cm::string_view const TypeIdWiX; }; diff --git a/Tests/RunCMake/include_external_msproject/ProjType-check-sln.cmake b/Tests/RunCMake/include_external_msproject/ProjType-check-sln.cmake new file mode 100644 index 0000000..b1f8ddb --- /dev/null +++ b/Tests/RunCMake/include_external_msproject/ProjType-check-sln.cmake @@ -0,0 +1,6 @@ +check_project(ProjType AspNetCore "" "8BB2217D-0F2D-49D1-97BC-3654ED321F3B" "" "") +check_project(ProjType DotNetCore "" "9A19103F-16F7-4668-BE54-9A1E7A4F7556" "" "") +check_project(ProjType Misc "" "66A2671D-8FB5-11D2-AA7E-00C04F688DDE" "" "") +check_project(ProjType SqlSrv "" "00D1A9C2-B5F0-4AF3-8072-F6C62B433612" "" "") +check_project(ProjType JScript "" "262852C6-CD72-467D-83FE-5EEB1973A190" "" "") +check_project(ProjType WebSite "" "E24C65DC-7377-472B-9ABA-BC803B73C61A" "" "") diff --git a/Tests/RunCMake/include_external_msproject/ProjType-check-slnx.cmake b/Tests/RunCMake/include_external_msproject/ProjType-check-slnx.cmake new file mode 100644 index 0000000..f1fd0fc --- /dev/null +++ b/Tests/RunCMake/include_external_msproject/ProjType-check-slnx.cmake @@ -0,0 +1,43 @@ +RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/ProjType.slnx" [[ +^<\?xml version="1\.0" encoding="UTF-8"\?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +$]]) diff --git a/Tests/RunCMake/include_external_msproject/ProjType-check.cmake b/Tests/RunCMake/include_external_msproject/ProjType-check.cmake new file mode 100644 index 0000000..5b37ec0 --- /dev/null +++ b/Tests/RunCMake/include_external_msproject/ProjType-check.cmake @@ -0,0 +1 @@ +include(${CMAKE_CURRENT_LIST_DIR}/ProjType-check-${sln_ext}.cmake) diff --git a/Tests/RunCMake/include_external_msproject/ProjType.cmake b/Tests/RunCMake/include_external_msproject/ProjType.cmake new file mode 100644 index 0000000..3e5c687 --- /dev/null +++ b/Tests/RunCMake/include_external_msproject/ProjType.cmake @@ -0,0 +1,6 @@ +include_external_msproject(AspNetCore AspNetCore.project TYPE 8BB2217D-0F2D-49D1-97BC-3654ED321F3B) +include_external_msproject(DotNetCore DotNetCore.project TYPE 9A19103F-16F7-4668-BE54-9A1E7A4F7556) +include_external_msproject(Misc Misc.project TYPE 66A2671D-8FB5-11D2-AA7E-00C04F688DDE) +include_external_msproject(SqlSrv SqlSrv.project TYPE 00D1A9C2-B5F0-4AF3-8072-F6C62B433612) +include_external_msproject(JScript JScript.project TYPE 262852C6-CD72-467D-83FE-5EEB1973A190) +include_external_msproject(WebSite WebSite.project TYPE E24C65DC-7377-472B-9ABA-BC803B73C61A) diff --git a/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake b/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake index 1a869be..25a83cb 100644 --- a/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake +++ b/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake @@ -9,6 +9,8 @@ else() endif() run_cmake(AutoType) +run_cmake(ProjType) + run_cmake(CustomGuid) run_cmake(CustomTypePlatform) run_cmake(CustomGuidTypePlatform) -- cgit v0.12 From 0c979127560c56f97836abcb383df63be088933b Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 19 Jan 2026 14:19:24 -0500 Subject: VS: Fix SLNX generation so .NET Core projects build in the IDE Extend commit 46b0202ce0 (VS: Fix SLNX generation so CSharp projects build in the IDE, 2025-10-23, v4.2.0-rc2~26^2) to cover .NET Core projects. Fixes: #27524 --- Source/cmVSSolution.cxx | 16 +++++++++++++--- .../include_external_msproject/ProjType-check-slnx.cmake | 1 + 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Source/cmVSSolution.cxx b/Source/cmVSSolution.cxx index cb2b259..c8d4775 100644 --- a/Source/cmVSSolution.cxx +++ b/Source/cmVSSolution.cxx @@ -311,6 +311,18 @@ void WriteSln(std::ostream& sln, Solution const& solution) } namespace { + +bool NeedExplicitProjectPlatform(cm::string_view typeId) +{ + // Some projects do not build interactively in the VS IDE unless they + // have an explicit platform, even if it matches the SLN platform. + if (typeId == Solution::Project::TypeIdCSharp || + typeId == Solution::Project::TypeIdDotNetCore) { + return true; + } + return false; +} + void WriteSlnxSolutionConfigurationPlatforms(cmXMLElement& xmlParent, Solution const& solution) { @@ -353,9 +365,7 @@ void WriteSlnxProject(cmXMLElement& xmlParent, Solution const& solution, } } 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) { + NeedExplicitProjectPlatform(project.TypeId)) { cmXMLElement(xmlProject, "Platform") .Attribute("Project", project.Platform); } diff --git a/Tests/RunCMake/include_external_msproject/ProjType-check-slnx.cmake b/Tests/RunCMake/include_external_msproject/ProjType-check-slnx.cmake index f1fd0fc..67aba13 100644 --- a/Tests/RunCMake/include_external_msproject/ProjType-check-slnx.cmake +++ b/Tests/RunCMake/include_external_msproject/ProjType-check-slnx.cmake @@ -26,6 +26,7 @@ RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/ProjType.slnx" [[ + -- cgit v0.12