diff --git a/docs/core/tools/dotnet-add-package.md b/docs/core/tools/dotnet-add-package.md index ecada9c28512d..5428d67b94f87 100644 --- a/docs/core/tools/dotnet-add-package.md +++ b/docs/core/tools/dotnet-add-package.md @@ -51,6 +51,74 @@ The *ToDo.csproj* file now contains a [``](/nuget/consume-pack ``` +If the project is onboarded onto [Central Package Management (CPM)](https://devblogs.microsoft.com/nuget/introducing-central-package-management/) the `` element in the `Directory.Packages.props file` is added/updated and the `` element is added to the project file. + +The following scenarios are currently supported. These examples assume that the latest version of `Microsoft.EntityFrameworkCore` is 6.0.4. Additional scenarios related to CPM are documented in [this design spec](https://github.com/NuGet/Home/pull/11915). + +Scenario 1: `` does not exist in the project file, `` element does not exist in the `Directory.Packages.props file`, and the version argument is not passed from the commandline. + + CLI command that is executed: `dotnet add ToDo.csproj package Microsoft.EntityFrameworkCore` + + The `` element is added to the `Directory.Packages.props file`. + + ```xml + + ``` + + The `` element is added to the project file. + + ```xml + + ``` + +Scenario 2: `` does not exist in the project file, `` element does not exist in the `Directory.Packages.props file`, and the version argument is passed from the commandline. + + CLI command that is executed: `dotnet add ToDo.csproj package Microsoft.EntityFrameworkCore --version 5.0.4` + + The `` element is added to the `Directory.Packages.props file`. + + ```xml + + ``` + + The `` element is added to the project file. + + ```xml + + ``` + +Scenario 3: `` does not exist in the project file, `` element does exist in the `Directory.Packages.props file`, and the version argument is not passed from the commandline. + + CLI command that is executed: `dotnet add ToDo.csproj package Microsoft.EntityFrameworkCore` + + The `` element is added to the `Directory.Packages.props file`. + + ```xml + + ``` + +The `` element is added to the project file. + + ```xml + + ``` + +Scenario 4: `` does not exist in the project file, `` element does exist in the `Directory.Packages.props file`, and the version argument is passed from the commandline. + + CLI command that is executed: `dotnet add ToDo.csproj package Microsoft.EntityFrameworkCore --version 5.0.4` + + The `` element is added to the `Directory.Packages.props file`. + + ```xml + + ``` + + The `` element is added to the project file. + + ```xml + + ``` + ### Implicit restore [!INCLUDE[DotNet Restore Note](../../../includes/dotnet-restore-note.md)]