-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spec for resolving '-p' in 'dotnet run' #229
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I think we should also describe how this will be a breaking change:
- In cases where the output of
dotnet run
is being parsed - In cases where the path to a project file passed in via
-p
includes an=
* Arguments for the resulting application, identified by `--`. | ||
* MSBuild arguments, which are not currently supported. | ||
|
||
To support the Xamarin/Maui workloads, we need to pass a property to MSBuild that specifies the device to target. This is being solved by adding a `--property` option to `dotnet run`. This will route to MSBuild as `-p:<delimited list>. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To support the Xamarin/Maui workloads, we need to pass a property to MSBuild that specifies the device to target. This is being solved by adding a `--property` option to `dotnet run`. This will route to MSBuild as `-p:<delimited list>. | |
To support the Xamarin/Maui workloads, we need to pass a property to MSBuild that specifies the device to target. This is being solved by adding a `--property` option to `dotnet run`. This will route to MSBuild as `-p:<delimited list>`. |
|
||
To support the Xamarin/Maui workloads, we need to pass a property to MSBuild that specifies the device to target. This is being solved by adding a `--property` option to `dotnet run`. This will route to MSBuild as `-p:<delimited list>. | ||
|
||
**Note:** A long term approach to managing “device” selection is planned for a later release. In .NET 6 CLI usage of these workloads is expected to just be CI, so this is not considered critical, and the design work is expected to include adjacent problems of specifying containers, and x64 emulation). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: get rid of smart quotes
**Note:** A long term approach to managing “device” selection is planned for a later release. In .NET 6 CLI usage of these workloads is expected to just be CI, so this is not considered critical, and the design work is expected to include adjacent problems of specifying containers, and x64 emulation). | |
**Note:** A long term approach to managing "device" selection is planned for a later release. In .NET 6 CLI usage of these workloads is expected to just be CI, so this is not considered critical, and the design work is expected to include adjacent problems of specifying containers, and x64 emulation). |
|
||
**Note:** A long term approach to managing “device” selection is planned for a later release. In .NET 6 CLI usage of these workloads is expected to just be CI, so this is not considered critical, and the design work is expected to include adjacent problems of specifying containers, and x64 emulation). | ||
|
||
A problem arises in the abbreviation. `-p`. It is currently used to specify the `--project` for `dotnet run`. This proposal is a course to change `-p` from meaning `--project` to `--property` in order to be consistent with the similar commands - `dotnet build` and ` dotnet publish`. This proposal balances backward compatibility and consistency with other commands, which we can do because the usages can be distinguished syntactically. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A problem arises in the abbreviation. `-p`. It is currently used to specify the `--project` for `dotnet run`. This proposal is a course to change `-p` from meaning `--project` to `--property` in order to be consistent with the similar commands - `dotnet build` and ` dotnet publish`. This proposal balances backward compatibility and consistency with other commands, which we can do because the usages can be distinguished syntactically. | |
A problem arises in the abbreviation `-p`. It is currently used to specify the `--project` for `dotnet run`. This proposal is a course to change `-p` from meaning `--project` to `--property` in order to be consistent with the similar commands - `dotnet build` and ` dotnet publish`. This proposal balances backward compatibility and consistency with other commands, which we can do because the usages can be distinguished syntactically. |
|
||
### Implementation notes | ||
|
||
We are displaying a deprecation warning for `-p` in .NET 6 and hope to do the additional work to support `-p`. However, once the deprecation is in place, we can add the abbreviation in a feature band (quarterly) release. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are displaying a deprecation warning for `-p` in .NET 6 and hope to do the additional work to support `-p`. However, once the deprecation is in place, we can add the abbreviation in a feature band (quarterly) release. | |
We plan to display a deprecation warning for `-p` in .NET 6 and hope to do the additional work to support `-p` as `--property`. However, once the deprecation is in place, we can add the abbreviation in a feature band (quarterly) release. |
The .NET CLI passes all command line arguments that are not explicitly handled through to MSBuild for `dotnet build` and `dotnet publish`. This does not work for `dotnet run` because there are three sets of arguments: | ||
|
||
* CLI arguments for `dotnet run` itself. | ||
* Arguments for the resulting application, identified by `--`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use --
to identify arguments for the resulting application, but you don't have to. Unrecognized arguments will be passed through. So part of the difference between dotnet run
and other commands is that dotnet run
passes unrecognized arguments to the app it runs, while other commands pass them through to MSBuild.
This also means that any parameters we add to dotnet run
are breaking changes, as if an app was previously using those parameters and they were being passed through to it without --
, then the app will no longer get them.
|
||
During a deprecation phase, which will be at least the length of .NET 6, older usage of `-p` as `--project` will be recognized as when there is no trailing colon (`-p:`) and the argument is not legal for MSBuild. Users will receive a warning that the abbreviation is deprecated. | ||
|
||
We will identify usage as `--property` when the argument is legal MSBuild syntax. Legal MSBuild syntax will be defined as: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will identify usage as `--property` when the argument is legal MSBuild syntax. Legal MSBuild syntax will be defined as: | |
We will interpret `-p` as `--property` when the argument value is legal MSBuild syntax. Legal MSBuild syntax will be defined as: |
The basic design is described in the opening: | ||
|
||
* `-p` with syntax that is valid for MSBuild properties will be treated as `--property`. | ||
* `-p:` will be passed to MSBuild so the an MSBuild error is displayed when the argument is illegal. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should drop the distinction between -p <value>
and -p:<value>
from this proposal. The -p:<value>
form currently works as --project
, so I don't think we should treat it any differently.
* `-p` with syntax that is valid for MSBuild properties will be treated as `--property`. | ||
* `-p:` will be passed to MSBuild so the an MSBuild error is displayed when the argument is illegal. | ||
* Any other usage will be treated as `--project` and will receive a warning that this use is deprecated. | ||
* Usage in the form `-p:` will be allowed but not encouraged or documented. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per prior comment, probably this line can be dropped.
* `-p:` will be passed to MSBuild so the an MSBuild error is displayed when the argument is illegal. | ||
* Any other usage will be treated as `--project` and will receive a warning that this use is deprecated. | ||
* Usage in the form `-p:` will be allowed but not encouraged or documented. | ||
* At some future point, we will remove `-p` for `--project`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we need to commit to eventually removing -p
as --project
.
* At some future point, we will remove `-p` for `--project`. | |
* At some future point, we may remove `-p` for `--project`. |
|
||
When -p is used (with no colon) in .NET 6, the following warning will be displayed: | ||
|
||
*“The abbreviation of -p for --project is deprecated. Please use --project.”* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*“The abbreviation of -p for --project is deprecated. Please use --project.”* | |
> Warning NETSDKNNNN: The abbreviation of -p for --project is deprecated. Please use --project. | |
Where `NNNN` will be replaced with an SDK error code. In contrast to many other errors and warnings generated by the .NET SDK, this warning will be generated by the .NET CLI parsing code instead of flowing through MSBuild. So it will not be affected by "warn as error" or "ignore warning" MSBuild settings. |
I'm not sure about the exact formatting we should use for the warning and error code.
|
||
* A comma or semi-colon delimited strings of values in the format <name>=<value> or <name>:<value>. We may simplify this to only checking for the equals - the simplest sufficient check will be used. | ||
|
||
If you have any scripts that are using “dotnet run” and process the output you could encounter a break. dotnet run typically doesn’t output anything of its own if there are no errors, so you only get the output of the program that is being run. If you have a script or other program wrapping “dotnet run” and parsing the output, the warning would be unexpected text and may cause a failure. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you have any scripts that are using “dotnet run” and process the output you could encounter a break. dotnet run typically doesn’t output anything of its own if there are no errors, so you only get the output of the program that is being run. If you have a script or other program wrapping “dotnet run” and parsing the output, the warning would be unexpected text and may cause a failure. | |
If you have any scripts that are using `dotnet run` and process the output you could encounter a break. `dotnet run` typically doesn’t output anything of its own if there are no errors, so you only get the output of the program that is being run. If you have a script or other program wrapping `dotnet run` and parsing the output, the warning would be unexpected text and may cause a failure. |
* Deprecate -p option (in short form) to dotnet watch Contributes to dotnet/designs#229
@KathleenDollard Are you going to look at the feedback and eventually merge this? |
* Deprecate -p option (in short form) to dotnet watch Contributes to dotnet/designs#229
dotnet run
has an abbreviation inconsistent with its sister commandsdotnet build
anddotnet publish
. This proposal is to change that with a deprecation path for the current usage.