sdk: dotnet run always prints info/compilation stuff to stdout; it shouldn't

Steps to reproduce

do dotnet new and dotnet restore and dotnet build and dotnet run > output.txt

Expected behavior

It should create a file output.txt with the contents Hello World!

Actual behavior

The actual contents of the output.txt file are

Project t (.NETStandard,Version=v1.5) was previously compiled. Skipping compilation.
Hello World!

Rationale

I am writing a text-processing utility, similar to grep/sed/awk. It’s obviously crucial that my utility can emit its output directly to stdout without this banner getting in the way.

Environment data

dotnet --version output: 1.0.0-beta-002133

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 12
  • Comments: 15 (7 by maintainers)

Commits related to this issue

Most upvoted comments

I dislike the dotnet run --no-build option because I always think the default should do the most appropriate thing for the most users.

In this case, if a user calls dotnet run with no options, they don’t care whether the project needs to be recompiled or not, they asked the project to be run, so they should only see run’s output.

But of course, if the build fails and the project couldn’t be run, then the user does care about those errors, because the project was not able to be run.

maybe it should only print out the “previously compiled” message on --verbose runs.

It would work something like this:

  • When dotnet build is called directly, print out the messages as usual.
  • When dotnet run is called directly, it calls dotnet build, it should pass in a --verbosity minimal parameter, so build only prints out absolutely necessary things (like build failures)
  • When dotnet --verbose run is called directly, everybody prints out everything.