Open
Description
Issue Description
On the CLI, dotnet watch test
at the solution level no longer supports the --project
flag, but its error message says that it does.
Steps to Reproduce
- Given a solution that contains multiple projects, where one of those projects is a test project
- Open a command line and navigate to the root of the solution (ie: the directory containing the
.sln
file) - Attempt to run the following command:
dotnet watch test
- Note that the command fails and returns an error text saying the following:
Could not find a MSBuild project file in 'C:\path\to\my\solution'. Specify which project to use with the --project option.
- Note that the above error text is the same error text that was returned by dotnet 8 under the same circumstances
- Attempt to run the following command:
dotnet watch test --project '.\mytestproject\mytestproject.csproj'
- Note that the command fails and returns an error text saying the following:
MSBUILD : error MSB1001: Unknown switch.
Full command line: 'C:\Program Files\dotnet\sdk\9.0.101\MSBuild.dll -maxcpucount -verbosity:m -tlp:default=auto -nologo -restore --property:VsTestUseMSBuildOutput=true -target:VSTest -nologo --project '.\mytestproject\mytestproject.csproj' -property:VSTestArtifactsProcessingMode=collect -property:VSTestSessionCorrelationId=48976_6a64fb8f-6486-4ca6-932b-526532e90e49'
Switches appended by response files:
Switch: --project
For switch syntax, type "MSBuild -help"
- Note that this error text is new, the command from step (6) used to work under dotnet 8, and the error text from step (7) contradicts the error text from step (4).
Expected Behavior
Error text should suggest options that the command supports, not nonexistent options
Actual Behavior
The two error messages contradict eachother
Analysis
- This appears to be a regression
- Does the dotnet team wish to support watching tests from the solution level, or do they wish for the user to navigate to the directory of the test project in order to watch tests? It seems simplest for the dotnet team to not have to support the
--project
flag.
Versions & Configurations
dotnet version: 9.0.101
msbuild version: 17.12.12.57101