Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 2, 2025

  • Replace net8.0 with $(CurrentTargetFramework) in App.csproj and Lib.csproj
  • Update .github/copilot-instructions.md to document using $(CurrentTargetFramework) for test projects
  • Verify all tests still pass (4/4 tests passed)
Original prompt

This section details on the original issue you should resolve

<issue_title>Revise CreateFromFilteredSolutionFile implementation for trailing comma (and allowing comments)</issue_title>
<issue_description>The current implementation of this method doesn't seem to allow trailing commas (and comments).

MSBuild supported trailing commas (and comments) of slnf files in dotnet/msbuild#6346

JsonElement root = JsonDocument.Parse(File.ReadAllText(filteredSolutionPath)).RootElement;

@baronfel @rainersigwald Another discrepancy due to not having a unified implementation/helper for how to parse solutions and solution filters. Not specific to test command this time :) </issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: marcpopMSFT <12663534+marcpopMSFT@users.noreply.github.com>
Copilot AI changed the title [WIP] Revise CreateFromFilteredSolutionFile for trailing commas and comments Support trailing commas and comments in .slnf files Dec 2, 2025
Copilot AI requested a review from marcpopMSFT December 2, 2025 01:28
@marcpopMSFT
Copy link
Member

@copilot please replace the two new net8.0 target frameworks you added with $(CurrentTargetFramework). Please update the copilot instructions to let future copilots know to always use $(CurrentTargetFramework) by default when creating new test projects.

@marcpopMSFT marcpopMSFT marked this pull request as ready for review December 5, 2025 21:36
Copilot AI review requested due to automatic review settings December 5, 2025 21:36
@marcpopMSFT
Copy link
Member

Tested in codespaces with a slnf that had trailing commas and comments.

…date copilot instructions

Co-authored-by: marcpopMSFT <12663534+marcpopMSFT@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 5, 2025

@copilot please replace the two new net8.0 target frameworks you added with $(CurrentTargetFramework). Please update the copilot instructions to let future copilots know to always use `$(CurrentTarg...

Done in 5fac8cb. Replaced both instances of net8.0 with $(CurrentTargetFramework) and added the guidance to the copilot instructions file.

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 adds support for trailing commas and JSON comments in solution filter (.slnf) files, aligning the SDK's behavior with MSBuild's support added in dotnet/msbuild#6346. The change modifies the JSON parsing in SlnFileFactory.CreateFromFilteredSolutionFile to allow these relaxed JSON features, improving developer experience when editing .slnf files.

Key Changes

  • Modified SlnFileFactory.cs to pass JsonDocumentOptions with AllowTrailingCommas = true and CommentHandling = JsonCommentHandling.Skip when parsing .slnf files
  • Added comprehensive test coverage with two new test cases validating both trailing commas and comments work correctly
  • Created TestAppWithTrailingCommaSlnf test asset with two .slnf files demonstrating both features

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/Cli/dotnet/SlnFileFactory.cs Configured JsonDocumentOptions to allow trailing commas and skip comments when parsing .slnf files
test/dotnet.Tests/CommandTests/Solution/List/GivenDotnetSlnList.cs Added two parameterized tests validating both "sln" and "solution" commands work with trailing commas and comments in .slnf files
test/TestAssets/TestProjects/TestAppWithTrailingCommaSlnf/AppWithTrailingComma.slnf Test asset demonstrating .slnf with trailing comma and comments
test/TestAssets/TestProjects/TestAppWithTrailingCommaSlnf/AppWithComments.slnf Test asset demonstrating .slnf with multi-line and single-line comments
test/TestAssets/TestProjects/TestAppWithTrailingCommaSlnf/App.sln Base solution file referenced by the test .slnf files
test/TestAssets/TestProjects/TestAppWithTrailingCommaSlnf/App/App.csproj App project referenced in the test solution
test/TestAssets/TestProjects/TestAppWithTrailingCommaSlnf/App/Program.cs Simple console app for test asset
test/TestAssets/TestProjects/TestAppWithTrailingCommaSlnf/Lib/Lib.csproj Library project referenced in the test solution
test/TestAssets/TestProjects/TestAppWithTrailingCommaSlnf/Lib/LibClass.cs Simple library class for test asset

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Revise CreateFromFilteredSolutionFile implementation for trailing comma (and allowing comments)

2 participants