This repository was archived by the owner on Nov 20, 2018. It is now read-only.

Description
Today:
dotnet watch -> dotnet run
dotnet watch --exit-on-change -> dotnet run -- --exit-on-change
dotnet watch --exit-on-change -- --arg -> dotnet run -- --arg (and the watcher gets the argument --exit-on-change
dotnet watch --command publish -- -f net451 -> dotnet publish -- -f net451 (which is incorrect because publish doesn't accept --).
So, we've optimized watch to work simply with run but we've introduced two bugs:
- You cannot run commands that don't accept a
-- (most of them)
- You cannot pass arguments to
run, not to the app being published.
I propose we make the following change.
Keep the current behaviour for run:
- No arguments ->
dotnet run
dotnet watch <args> -> dotnet run -- <args>
Change the behaviour for --command to not assume that the command accepts --:
dotnet watch --command test -- --foo -> dotnet test --foo
dotnet watch --command run -- -f net451 -> dotnet run -f net451
These two commands are then equivalent:
dotnet watch --foo
dotnet watch --command run -- -- --foo (yes, there's a double --. The first -- separates the watcher arguments and the second one separates dotnet run arguments).
So, everytime you specify --command we pass whatever is after -- verbatim. If --command is not specified, we append -- and then pass the rest of the arguments.
cc @glennc @muratg