8000 `dotnet watch test` at the solution level provides an incorrect error message · Issue #45761 · dotnet/sdk · GitHub
[go: up one dir, main page]

Skip to content
dotnet watch test at the solution level provides an incorrect error message #45761
Open
@dhazel

Description

@dhazel

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

  1. Given a solution that contains multiple projects, where one of those projects is a test project
  2. Open a command line and navigate to the root of the solution (ie: the directory containing the .sln file)
  3. Attempt to run the following command: dotnet watch test
  4. 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.
  1. Note that the above error text is the same error text that was returned by dotnet 8 under the same circumstances
  2. Attempt to run the following command: dotnet watch test --project '.\mytestproject\mytestproject.csproj'
  3. 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"
  1. 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

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0