VS: Add SLNX default startup project

At the time of commit e6aa7742b0 (VS: Generate .slnx files for VS 2026,
2025-09-17, v4.2.0-rc1~151^2), the VS 18 Insiders edition did not offer
support for specifying a default startup project in `.slnx` files.
This has since been added, so use it.

Fixes: #27387
This commit is contained in:
Brad King
2025-11-14 10:56:16 -05:00
parent 64a9839c25
commit 70ed720232
24 changed files with 27 additions and 24 deletions

View File

@@ -312,6 +312,9 @@ void WriteSlnxProject(cmXMLElement& xmlParent, Solution const& solution,
cmXMLElement xmlProject(xmlParent, "Project");
xmlProject.Attribute("Path", project.Path);
xmlProject.Attribute("Id", cmSystemTools::LowerCase(project.Id));
if (project.Name == solution.StartupProject) {
xmlProject.Attribute("DefaultStartup", "true");
}
for (Solution::Project const* d : project.BuildDependencies) {
cmXMLElement(xmlProject, "BuildDependency").Attribute("Project", d->Path);
}

View File

@@ -8,7 +8,7 @@ RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/AddPackageToDefault.slnx" [[
<BuildType Name="RelWithDebInfo"/>
<Platform Name="[^"]+"/>
</Configurations>
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+">
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+" DefaultStartup="true">
<BuildDependency Project="ZERO_CHECK\.vcxproj"/>
</Project>
<Project Path="PACKAGE.vcxproj" Id="[0-9a-f-]+">

View File

@@ -16,7 +16,7 @@ RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/CMP0143-NEW.slnx" [[
<Build Solution="RelWithDebInfo\|\*" Project="false"/>
</Project>
<Folder Name="/CMakePredefinedTargets/">
<Project Path="ALL_BUILD.vcxproj" Id="[0-9a-f-]+">
<Project Path="ALL_BUILD.vcxproj" Id="[0-9a-f-]+" DefaultStartup="true">
<BuildDependency Project="ZERO_CHECK.vcxproj"/>
<Build Solution="Debug\|\*" Project="false"/>
<Build Solution="Release\|\*" Project="false"/>

View File

@@ -8,7 +8,7 @@ RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/CMP0143-OLD.slnx" [[
<BuildType Name="RelWithDebInfo"/>
<Platform Name="[^"]+"/>
</Configurations>
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+">
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+" DefaultStartup="true">
<BuildDependency Project="ZERO_CHECK\.vcxproj"/>
<Build Solution="Debug\|\*" Project="false"/>
<Build Solution="Release\|\*" Project="false"/>

View File

@@ -8,7 +8,7 @@ RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/CMP0143-WARN.slnx" [[
<BuildType Name="RelWithDebInfo"/>
<Platform Name="[^"]+"/>
</Configurations>
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+">
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+" DefaultStartup="true">
<BuildDependency Project="ZERO_CHECK\.vcxproj"/>
<Build Solution="Debug\|\*" Project="false"/>
<Build Solution="Release\|\*" Project="false"/>

View File

@@ -8,7 +8,7 @@ RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/DeployEnabled.slnx" [[
<BuildType Name="RelWithDebInfo"/>
<Platform Name="[^"]+"/>
</Configurations>
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+">
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+" DefaultStartup="true">
<BuildDependency Project="ZERO_CHECK\.vcxproj"/>
<BuildDependency Project="foo\.vcxproj"/>
<Build Solution="Debug\|\*" Project="false"/>

View File

@@ -8,7 +8,7 @@ RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/MorePost.slnx" [[
<BuildType Name="RelWithDebInfo"/>
<Platform Name="[^"]+"/>
</Configurations>
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+">
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+" DefaultStartup="true">
<BuildDependency Project="ZERO_CHECK\.vcxproj"/>
<Build Solution="Debug\|\*" Project="false"/>
<Build Solution="Release\|\*" Project="false"/>

View File

@@ -8,7 +8,7 @@ RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/MorePre.slnx" [[
<BuildType Name="RelWithDebInfo"/>
<Platform Name="[^"]+"/>
</Configurations>
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+">
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+" DefaultStartup="true">
<BuildDependency Project="ZERO_CHECK\.vcxproj"/>
<Build Solution="Debug\|\*" Project="false"/>
<Build Solution="Release\|\*" Project="false"/>

View File

@@ -8,7 +8,7 @@ RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/OnePost.slnx" [[
<BuildType Name="RelWithDebInfo"/>
<Platform Name="[^"]+"/>
</Configurations>
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+">
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+" DefaultStartup="true">
<BuildDependency Project="ZERO_CHECK\.vcxproj"/>
<Build Solution="Debug\|\*" Project="false"/>
<Build Solution="Release\|\*" Project="false"/>

View File

@@ -8,7 +8,7 @@ RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/OnePre.slnx" [[
<BuildType Name="RelWithDebInfo"/>
<Platform Name="[^"]+"/>
</Configurations>
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+">
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+" DefaultStartup="true">
<BuildDependency Project="ZERO_CHECK\.vcxproj"/>
<Build Solution="Debug\|\*" Project="false"/>
<Build Solution="Release\|\*" Project="false"/>

View File

@@ -8,7 +8,7 @@ RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/Override1.slnx" [[
<BuildType Name="RelWithDebInfo"/>
<Platform Name="[^"]+"/>
</Configurations>
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+">
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+" DefaultStartup="true">
<BuildDependency Project="ZERO_CHECK\.vcxproj"/>
<Build Solution="Debug\|\*" Project="false"/>
<Build Solution="Release\|\*" Project="false"/>

View File

@@ -8,7 +8,7 @@ RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/Override2.slnx" [[
<BuildType Name="RelWithDebInfo"/>
<Platform Name="[^"]+"/>
</Configurations>
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+">
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+" DefaultStartup="true">
<BuildDependency Project="ZERO_CHECK\.vcxproj"/>
<Build Solution="Debug\|\*" Project="false"/>
<Build Solution="Release\|\*" Project="false"/>

View File

@@ -8,7 +8,7 @@ RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/Override3.slnx" [[
<BuildType Name="RelWithDebInfo"/>
<Platform Name="[^"]+"/>
</Configurations>
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+">
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+" DefaultStartup="true">
<BuildDependency Project="ZERO_CHECK\.vcxproj"/>
<Build Solution="Debug\|\*" Project="false"/>
<Build Solution="Release\|\*" Project="false"/>

View File

@@ -8,7 +8,7 @@ RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/PrePost.slnx" [[
<BuildType Name="RelWithDebInfo"/>
<Platform Name="[^"]+"/>
</Configurations>
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+">
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+" DefaultStartup="true">
<BuildDependency Project="ZERO_CHECK\.vcxproj"/>
<Build Solution="Debug\|\*" Project="false"/>
<Build Solution="Release\|\*" Project="false"/>

View File

@@ -8,7 +8,7 @@ RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/SolutionItems.slnx" [[
<BuildType Name="RelWithDebInfo"/>
<Platform Name="[^"]+"/>
</Configurations>
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+">
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+" DefaultStartup="true">
<BuildDependency Project="ZERO_CHECK\.vcxproj"/>
<Build Solution="Debug\|\*" Project="false"/>
<Build Solution="Release\|\*" Project="false"/>
@@ -38,7 +38,7 @@ RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/SolutionItems/SolutionItemsSubp
<BuildType Name="RelWithDebInfo"/>
<Platform Name="[^"]+"/>
</Configurations>
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+">
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+" DefaultStartup="true">
<BuildDependency Project="\.\./ZERO_CHECK\.vcxproj"/>
<Build Solution="Debug\|\*" Project="false"/>
<Build Solution="Release\|\*" Project="false"/>

View File

@@ -15,7 +15,7 @@ RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/StartupProject.slnx" [[
<Build Solution="MinSizeRel\|\*" Project="false"/>
<Build Solution="RelWithDebInfo\|\*" Project="false"/>
</Project>
<Project Path="TestStartup\.vcxproj" Id="[0-9a-f-]+">
<Project Path="TestStartup\.vcxproj" Id="[0-9a-f-]+" DefaultStartup="true">
<BuildDependency Project="ZERO_CHECK\.vcxproj"/>
<Build Solution="Debug\|\*" Project="false"/>
<Build Solution="Release\|\*" Project="false"/>

View File

@@ -8,7 +8,7 @@ RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/StartupProjectMissing.slnx" [[
<BuildType Name="RelWithDebInfo"/>
<Platform Name="[^"]+"/>
</Configurations>
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+">
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+" DefaultStartup="true">
<BuildDependency Project="ZERO_CHECK\.vcxproj"/>
<Build Solution="Debug\|\*" Project="false"/>
<Build Solution="Release\|\*" Project="false"/>

View File

@@ -8,7 +8,7 @@ RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/StartupProjectUseFolders.slnx"
<BuildType Name="RelWithDebInfo"/>
<Platform Name="[^"]+"/>
</Configurations>
<Project Path="TestStartup\.vcxproj" Id="[0-9a-f-]+">
<Project Path="TestStartup\.vcxproj" Id="[0-9a-f-]+" DefaultStartup="true">
<BuildDependency Project="ZERO_CHECK.vcxproj"/>
<Build Solution="Debug\|\*" Project="false"/>
<Build Solution="Release\|\*" Project="false"/>

View File

@@ -8,7 +8,7 @@ RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/VsDotnetSdkTargetPlatform.slnx"
<BuildType Name="RelWithDebInfo"/>
<Platform Name="[^"]+"/>
</Configurations>
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+">
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+" DefaultStartup="true">
<BuildDependency Project="ZERO_CHECK\.vcxproj"/>
<BuildDependency Project="foo\.csproj"/>
<Build Solution="Debug\|\*" Project="false"/>

View File

@@ -8,7 +8,7 @@ RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/AutoType.slnx" [[
<BuildType Name="RelWithDebInfo"/>
<Platform Name="[^"]+"/>
</Configurations>
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+">
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+" DefaultStartup="true">
<BuildDependency Project="ZERO_CHECK\.vcxproj"/>
<BuildDependency Project="external\.csproj"/>
<BuildDependency Project="external\.dbproj"/>

View File

@@ -8,7 +8,7 @@ RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/CustomConfig.slnx" [[
<BuildType Name="RelWithDebInfo"/>
<Platform Name="[^"]+"/>
</Configurations>
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+">
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+" DefaultStartup="true">
<BuildDependency Project="ZERO_CHECK\.vcxproj"/>
<BuildDependency Project="external.project"/>
<Build Solution="Debug\|\*" Project="false"/>

View File

@@ -8,7 +8,7 @@ RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/CustomGuid.slnx" [[
<BuildType Name="RelWithDebInfo"/>
<Platform Name="[^"]+"/>
</Configurations>
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+">
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+" DefaultStartup="true">
<BuildDependency Project="ZERO_CHECK\.vcxproj"/>
<BuildDependency Project="external.project"/>
<Build Solution="Debug\|\*" Project="false"/>

View File

@@ -8,7 +8,7 @@ RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/CustomGuidTypePlatform.slnx" [[
<BuildType Name="RelWithDebInfo"/>
<Platform Name="[^"]+"/>
</Configurations>
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+">
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+" DefaultStartup="true">
<BuildDependency Project="ZERO_CHECK\.vcxproj"/>
<BuildDependency Project="external.project"/>
<Build Solution="Debug\|\*" Project="false"/>

View File

@@ -8,7 +8,7 @@ RunCMake_check_slnx("${RunCMake_TEST_BINARY_DIR}/CustomTypePlatform.slnx" [[
<BuildType Name="RelWithDebInfo"/>
<Platform Name="[^"]+"/>
</Configurations>
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+">
<Project Path="ALL_BUILD\.vcxproj" Id="[0-9a-f-]+" DefaultStartup="true">
<BuildDependency Project="ZERO_CHECK\.vcxproj"/>
<BuildDependency Project="external.project"/>
<Build Solution="Debug\|\*" Project="false"/>