diff --git a/src/app/Fake.DotNet.Cli/DotNet.fs b/src/app/Fake.DotNet.Cli/DotNet.fs index 98f0ab4e668..aeebed979f2 100644 --- a/src/app/Fake.DotNet.Cli/DotNet.fs +++ b/src/app/Fake.DotNet.Cli/DotNet.fs @@ -1766,6 +1766,16 @@ module DotNet = /// order of tests execution before the crash. (--blame) Blame: bool + /// Specifies the project to test via the --project flag (SDK 10+). + /// When set, overrides the positional project argument passed to . + /// Use this instead of the positional argument when targeting SDK 10+ with Microsoft.Testing.Platform. + /// (--project) + Project: string option + + /// Specifies the solution to test via the --solution flag (SDK 10+). + /// (--solution) + Solution: string option + /// Other msbuild specific parameters MSBuildParams: MSBuild.CliArguments } @@ -1789,6 +1799,8 @@ module DotNet = NoRestore = false RunSettingsArguments = None Blame = false + Project = None + Solution = None MSBuildParams = MSBuild.CliArguments.Create() } /// Gets the current environment @@ -1820,7 +1832,9 @@ module DotNet = param.ResultsDirectory |> Option.toList |> argList2 "results-directory" param.Collect |> Option.toList |> argList2 "collect" param.NoRestore |> argOption "no-restore" - param.Blame |> argOption "blame" ] + param.Blame |> argOption "blame" + param.Project |> Option.toList |> argList2 "project" + param.Solution |> Option.toList |> argList2 "solution" ] |> List.concat |> List.filter (not << String.IsNullOrEmpty) @@ -1834,7 +1848,8 @@ module DotNet = let test setParams project = 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 ] + let args = positionalArg @ buildTestArgs param execWithBinLog project param.Common "test" args param.MSBuildParams param.RunSettingsArguments __.MarkSuccess()