Repository navigation
Pick the solution named after its directory, else the ordinally first [patch] - #96
Open
matt-edmondson wants to merge 1 commit into
Open
matt-edmondson wants to merge 1 commit into
matt-edmondson wants to merge 1 commit into
Conversation
… [patch] Sdk.props took the first entry of Directory.GetFiles, which guarantees no order, so with several solution files SolutionName - and the project-type detection, ToolCommandName and package identity keyed on it - depended on the file system. Prefer the solution named after the solution directory, otherwise take the ordinally smallest path, and warn KTSU1006 when the pick was ambiguous and SolutionName was not already set. Fixes #92 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017vfJW5RdbhA7TAMDQD8QTG
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes #92
What was wrong
Sdk.propstook_SolutionFiles.Split(';')[0]fromDirectory.GetFiles, which guarantees no order. In a directory with several solution files,SolutionNametherefore depended on the file system: NTFS lists alphabetically, ext4 by hash. Project-type detection,ToolCommandNameand package identity all depend onSolutionName. The issue's repro (Aaa.sln,Foo.sln,Foo.Samples.slnbesideFoo.Tool) pickedFoo.Sampleson Linux, so the tool project stopped being detected as one.Change
Sdk/Sdk.props: with several candidates (.slnxis still preferred over.sln), the solution named after the solution directory wins. Otherwise the ordinally smallest path is used. MSBuild property functions can't sort, so the minimum is unrolled over the first ten candidates (String.CompareOrdinal). That is far more solution files than one directory holds in practice. A solution that setSolutionPath(dotnet build Foo.sln) still wins, as before.Sdk/Sdk.targets: new warning KTSU1006. It fires when the pick was not the directory-named solution andSolutionNamewasn't already set. The message tells the user to setSolutionNameinDirectory.Build.props. It runs once per project: in the outer build, not again in every inner build.Tests
New
SolutionDiscoveryTests(5 tests):SolutionNameis setWith the
Sdk.props/Sdk.targetschange reverted, all 5 fail. The two behaviour tests fail with exactly the issue's symptom:Expected:<Demo>. Actual:<Demo.Samples>andExpected:<Alpha>. Actual:<Demo>.Full
Sdk.Examples.Testssuite on this branch (Linux): 111 passed, 0 failed.Generated by Claude Code