Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dotnet watch test at the solution level provides an incorrect error message #45761

Open
dhazel opened this issue Jan 7, 2025 · 0 comments
Open
Labels
Area-CLI untriaged Request triage from a team member

Comments

@dhazel
Copy link

dhazel commented Jan 7, 2025

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

@baronfel baronfel transferred this issue from dotnet/msbuild Jan 7, 2025
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-CLI untriaged Request triage from a team member labels Jan 7, 2025
@dhazel dhazel changed the title dotnet watch test at the solution level no longer supports the --project flag dotnet watch test at the solution level provides an incorrect error message Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-CLI untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests

1 participant