Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,41 +9,25 @@ ms.date: 07/13/2021

This warning comes from the CLI parser, so it won't generally cause failures when warnings are treated as errors. However, if your process wraps MSBuild or CI and checks for the text "Warning", the warning will appear in that check.

Also, if you pass `--property` as an option to the application being run, the `--` syntax separator must be used.

## Version introduced

.NET SDK 6.0.100 Preview 6

## Old behavior

In previous .NET versions:

- `-p` indicated `--project`.
- `--property` was not a valid option on `dotnet run`. This option was passed through to the underlying application, even if you omitted the `--` syntax separator.
In previous .NET versions, `-p` indicated `--project`.

## New behavior

Starting in .NET 6:

- Passing `-p` to `dotnet run` results in a warning that it is deprecated and to use the full `--project` option instead. Despite the warning, `-p` is still a valid abbreviation for `--project`, unless the argument includes an equals `=` character (in which case the option is interpreted as `--property`).
- `--property` is now a valid option on `dotnet run`. This option is not passed through to the underlying application, unless you use the `--` syntax separator.
Starting in .NET 6, passing `-p` to `dotnet run` results in a warning that it is deprecated and to use the full `--project` option instead. Despite the warning, `-p` is still a valid abbreviation for `--project`, unless the argument includes an equals `=` character (in which case the option is interpreted as `--property`).

## Reason for change

We are deprecating `-p` because of the close relationship `dotnet run` has with `dotnet build` and `dotnet publish`. This breaking change is the first step in aligning abbreviations for these commands.

To embrace Xamarin (MAUI), we need to pass MSBuild properties to MSBuild during the build portion of `dotnet run`. The option that specifies passing properties should be the same for `dotnet run`, `dotnet build`, and `dotnet publish`.

## Recommended action

If you encounter the new warning, use `--project`. If you have a project argument that includes an `=` and you use the `-p` abbreviation, the option will be interpreted as `--property` and passed to MSBuild. In this case, use `--project` to pass the argument to your application in all cases.

If your application has an option called `--property`, you'll need to use the syntax separator `--` to pass the value to your application:

```cmd
dotnet run -- --property myPropertyValue
```
If you encounter the new warning, use `--project`. If you have a project argument that includes an `=` and you use the `-p` abbreviation, the option will be interpreted as `--property`.

Review any scripts that use `dotnet run` where you might overlook the warning if `-p` is used.

Expand Down