Add Project/Solution flags to DotNet.TestOptions for SDK 10+ support#2897
Draft
bartelink wants to merge 1 commit into
Draft
Add Project/Solution flags to DotNet.TestOptions for SDK 10+ support#2897bartelink wants to merge 1 commit into
bartelink wants to merge 1 commit into
Conversation
SDK 10 no longer accepts positional project/solution args for 'dotnet test'. Instead, '--project' or '--solution' flags must be used. This adds: - Project: string option → --project flag - Solution: string option → --solution flag - Filters empty positional 'project' arg from the command (avoids crash when using Project/Solution fields with empty string as positional arg) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds support for the new dotnet test targeting flags introduced in newer SDKs by allowing --project / --solution to be passed via TestOptions, and avoids emitting an empty positional project argument.
Changes:
- Extend
TestOptionswithProjectandSolutionoptional fields and defaults. - Include
--project/--solutionindotnet testargument construction. - Stop passing an empty positional
projectargument todotnet test.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1851
to
+1852
| let positionalArg = if String.IsNullOrEmpty project then [] else [ project ] | ||
| let args = positionalArg @ buildTestArgs param |
| use __ = Trace.traceTask "DotNet:test" project | ||
| let param = TestOptions.Create() |> setParams | ||
| let args = project :: buildTestArgs param | ||
| let positionalArg = if String.IsNullOrEmpty project then [] else [ project ] |
Member
Author
There was a problem hiding this comment.
also doesnt use solution arg - probably needs to be mutually exclusive and added at end after positional args
Contributor
bartelink
commented
May 30, 2026
| @@ -1766,6 +1766,16 @@ module DotNet = | |||
| /// order of tests execution before the crash. (<c>--blame</c>) | |||
| Blame: bool | |||
Member
Author
There was a problem hiding this comment.
needs comment to mention it doesnt work for MTP anymore
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.
Hm, my agent jumped the gun on actually raising a PR but here we are...
Still need to figure out whether mutually exclusive
optionargs are idiomatic for FAKE.Also it appears that
--project project.slnxjust works, so maybe a different approach is possible.Using a workaround in Argu until I get comments on this; it's not urgent from my perspective...
Problem
SDK 10 no longer accepts a positional project/solution path for
dotnet test. The argument must be passed via--projector--solutionflags:Users migrating to Microsoft.Testing.Platform v2 with SDK 10 face an additional issue: MTP v2 crashes (
IndexOutOfRangeException, exit code 134) if an empty string is passed as an argument. This means the current workaround of passing""as the project with--projectinCustomParamsfails.Fix
Project: string option→--projectflagSolution: string option→--solutionflagprojectis empty (allowsDotNet.test id ""+Project = Some path)Usage (SDK 10 + MTP v2)
Backward compatibility
No breaking change — existing callers passing a positional path continue to work unchanged. The
Project/Solutionfields default toNone.