Rewrite dotnet watch command line parsing #39618
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Instead of launching process directly in Hot Reload with Hot Reload environment variables set on the process start info, we now launch
dotnet run
(or any otherdotnet
command) with Hot Reload variables set via environment directives (i.e.dotnet [env:XYZ=...] run <remaining args>
). This allows us to avoid interpreting the subcommand and most of the command line options and arguments passed todotnet watch
. We can now easily support any existingdotnet
subcommand.We have 3 kinds of options:
dotnet-watch specific (such as
--verbose
)These are consumed by dotnet-watch and not included in
<remaining args>
options that dotnet-watch needs to understand but are passed through to the subcommand (e.g. --launch-profile)
We parse these and include them in
<remaining args>
(if they precede the subcommand they are moved after the subcommand).other options
These are not interpreted, just included in
<remaining args>
.Fixes #39020
Fixes dotnet/aspnetcore#52294
Fixes #36611
Fixes #34055
Fixes #29539
Fixes #25612