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
- Merge pull request #2174 from dsplaisted/set-default-assets-path Set ProjectAssetsFile property in SDK if it's not already set — committed to wli3/cli by dsplaisted 6 years ago
I dislike the
dotnet run --no-buildoption because I always think the default should do the most appropriate thing for the most users.In this case, if a user calls
dotnet runwith 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 seerun’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
--verboseruns.It would work something like this:
dotnet buildis called directly, print out the messages as usual.dotnet runis called directly, it callsdotnet build, it should pass in a--verbosity minimalparameter, so build only prints out absolutely necessary things (like build failures)dotnet --verbose runis called directly, everybody prints out everything.