Skip to content

Conversation

@adamperlin
Copy link
Contributor

When running .\build.cmd -vs coreclr.slnx for example, the solution would not be found as a hardcoded .sln was still being used. This also changes the logic to use a regex instead for the hardcoded cases which we recognized in the -vs argument.

Copilot AI review requested due to automatic review settings December 8, 2025 21:49
@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Dec 8, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the build script to support both .sln and .slnx solution file extensions when using the -vs flag. The change modernizes the logic by replacing exact string comparisons with regex patterns and updates the generated solution file paths from .sln to .slnx.

Key Changes

  • Replaced case-insensitive equality checks (-ieq) with regex patterns (-match) to accept multiple input formats: coreclr, coreclr.sln, or coreclr.slnx
  • Updated the generated solution file paths from CoreCLR.sln to CoreCLR.slnx and corehost.sln to corehost.slnx
  • Applied the same changes to both coreclr and corehost solution handling logic

@am11
Copy link
Member

am11 commented Dec 8, 2025

It is cmake generated project. We discussed earlier that we want to wait until minimum cmake version is revved to 4.2 which added .slnx support (#120823 is updating min version to 3.6).

@jkoritzinsky

Copy link
Member

@jkoritzinsky jkoritzinsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd recommend rewording the comment as the Copilot review mentioned, but other than that LGTM

@jkoritzinsky
Copy link
Member

It is cmake generated project. We discussed earlier that we want to wait until minimum cmake version is revved to 4.2 which added .slnx support (#120823 is updating min version to 3.6).

@jkoritzinsky

I think it's worth supporting .slnx as an option so people who use the newer CMake versions can use -vs coreclr.

@am11
Copy link
Member

am11 commented Dec 8, 2025

I think it's worth supporting .slnx as an option so people who use the newer CMake versions can use -vs coreclr.

@jkoritzinsky, the way this change is proposed, we can't use it with old VS (Join-Path -ChildPath "CoreCLR.sln" -> `Join-Path -ChildPath "CoreCLR.slnx") although the condition accounts for both sln and slnx?

@adamperlin
Copy link
Contributor Author

@am11 Would you prefer I change the condition to account for just slnx to avoid confusion?

@am11
Copy link
Member

am11 commented Dec 8, 2025

@adamperlin, I meant to keep support for both extensions in this transition period: am11@3da5eba. Once the minimum CMake version requirement moves past 4.2, we can remove .sln fallback branches.

@jkoritzinsky
Copy link
Member

@am11, you're right, I didn't notice that it would only resolve slnx now. @adamperlin can you set it up to resolve slnx or sln, whichever is present? (Preferring slnx if it both exist)

@adamperlin
Copy link
Contributor Author

@am11, you're right, I didn't notice that it would only resolve slnx now. @adamperlin can you set it up to resolve slnx or sln, whichever is present? (Preferring slnx if it both exist)

Yes, I can definitely set it up to resolve that way!

@adamperlin
Copy link
Contributor Author

adamperlin commented Dec 12, 2025

@jkoritzinsky @am11 Can you take another look? I've updated this now to resolve to .sln if .sln is present in the arg, otherwise .slnx will be used!

@adamperlin adamperlin merged commit a0f3fea into dotnet:main Dec 13, 2025
149 of 151 checks passed
@adamperlin adamperlin deleted the adamperlin/build-script-solution-gen-fix branch December 13, 2025 00:24
@github-actions github-actions bot locked and limited conversation to collaborators Jan 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants