Skip to content
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

Deprecating -p for --project for dotnet run #24727

Closed
1 of 23 tasks
KathleenDollard opened this issue Jun 17, 2021 · 2 comments · Fixed by #25108
Closed
1 of 23 tasks

Deprecating -p for --project for dotnet run #24727

KathleenDollard opened this issue Jun 17, 2021 · 2 comments · Fixed by #25108
Assignees
Labels
breaking-change Indicates a .NET Core breaking change 🏁 Release: .NET 6 Issues and PRs for the .NET 6 release doc-idea Indicates issues that are suggestions for new topics [org][type][category] Pri1 High priority, do before Pri2 and Pri3

Comments

@KathleenDollard
Copy link
Contributor

KathleenDollard commented Jun 17, 2021

This change is documented in Spec for resolving '-p' in 'dotnet run'

Deprecate -p

-p will no longer be a valid abbreviation for project. In .NET 6, users will receive a warning.

This warning will be from the CLI parser, so will not generally trigger WarningsAsErrors failures. However, if a wrapping MSBuild or CI process checks for the text "Warning" it will appear in that check.

Also, if --property is an option passed to the application being run, the -- syntax separator must be used.

Version introduced

.NET Core 6.0 Preview 6

Old behavior

  • -p previously indicated --project.
  • --property was not a valid option on dotnet run and was passed through to the underlying application, even if the -- syntax separator was not used.

New behavior

  • -p will retain this meaning for .NET 6, but will result in a warning that it is deprecated and to use the full --project. At some future point, we will remove the use of -p to indicate --project.
  • --property is now a valid option on dotnet run and this option will not be passed through to the underlying application, unless the -- syntax separator is used.

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.

Embracing Xamarin/Maui results in a need to pass MSBuild properties to MSBuild during the build portion of dotnet run. We want the option specifying this to be the same for dotnet run, dotnet build and dotnet publish.

Recommended action

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

If you have an application that has an option called --property, you will need to use the syntax separator to pass the the value to your application:

dotnet run -- --property myPropertyValue

Please review any scripts that use dotnet run where you might overlook the warning if -p is 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.

Category

  • ASP.NET Core
  • C#
  • Code analysis
  • Core .NET libraries
  • Cryptography
  • Data
  • Debugger
  • Deployment
  • Globalization
  • Interop
  • JIT
  • LINQ
  • Managed Extensibility Framework (MEF)
  • MSBuild
  • Networking
  • Printing
  • SDK
  • Security
  • Serialization
  • Visual Basic
  • Windows Forms
  • Windows Presentation Foundation (WPF)
  • XML, XSLT

Affected APIs

Not detectable via API analysis


Issue metadata

  • Issue type: breaking-change
@PRMerger8 PRMerger8 added the Pri3 label Jun 17, 2021
@dotnet-bot dotnet-bot added the ⌚ Not Triaged Not triaged label Jun 17, 2021
@gewarren gewarren self-assigned this Jun 17, 2021
@gewarren gewarren added doc-idea Indicates issues that are suggestions for new topics [org][type][category] Pri1 High priority, do before Pri2 and Pri3 breaking-change Indicates a .NET Core breaking change and removed Pri3 labels Jun 17, 2021
@kyle-rader
Copy link

I respect the desire for aligning the options of build, run, and publish. But as someone who types dotnet run -p all the time every day, removing -p instead of adding it to the others makes me a little sad.

@paulomorgado
Copy link
Contributor

Is it possible to deprecate -p in favor of nothing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change Indicates a .NET Core breaking change 🏁 Release: .NET 6 Issues and PRs for the .NET 6 release doc-idea Indicates issues that are suggestions for new topics [org][type][category] Pri1 High priority, do before Pri2 and Pri3
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants