Skip to content

'--no-build' flag messes with 'dotnet run' error messagesΒ #24591

@liebasam

Description

@liebasam

Describe the bug

Calling 'dotnet run --no-build ' on a project file that doesn't exist produces the error message:

is not a valid project file.

Just spent hours trying to debug why running the project locally worked just fine, but stopped working in a CI setting. The message leads one to believe its an issue with the csproj file or environment, when in reality the file just doesn't exist. (In my case, underlying cuase was a double quoting issue)

For whatever reason, removing the '--no-build' flag makes for a better message:

Project file does not exist.

To Reproduce

Version 5.0.403 of .NET SDK. Reproduced on Windows 10 + Debian 10

> dotnet run --project xyz.csproj
MSBUILD : error MSB1009: Project file does not exist.
Switch: xyz.csproj

The build failed. Fix the build errors and run again.
> dotnet run --project xyz.csproj --no-build
'xyz.csproj' is not a valid project file.

Further technical details

.NET SDK (reflecting any global.json):
 Version:   5.0.403
 Commit:    bf9d168ac2

Runtime Environment:
 OS Name:     debian
 OS Version:  10
 OS Platform: Linux
 RID:         debian.10-x64
 Base Path:   <network location at my job>

Host (useful for support):
  Version: 5.0.12
  Commit:  7211aa01b3

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions