diff options
Diffstat (limited to 'doc/user/packages/nuget_repository/index.md')
-rw-r--r-- | doc/user/packages/nuget_repository/index.md | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/doc/user/packages/nuget_repository/index.md b/doc/user/packages/nuget_repository/index.md index 340df4a3c5f..f5430c5328c 100644 --- a/doc/user/packages/nuget_repository/index.md +++ b/doc/user/packages/nuget_repository/index.md @@ -492,6 +492,85 @@ dotnet add package <package_id> \ - `<package_id>` is the package ID. - `<package_version>` is the package version. Optional. +### Install a package using NuGet v2 feed + +> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/416405) in GitLab 16.5. + +Prerequisites: + +- The project-level Package Registry is a [v2 feed source](#add-a-source-with-chocolatey-cli) for Chocolatey. +- A version must be provided when installing or upgrading a package using NuGet v2 feed. + +To install a package with the Chocolatey CLI: + +```shell +choco install <package_id> -Source <source_url> -Version <package_version> +``` + +In this command: + +- `<package_id>` is the package ID. +- `<source_url>` is the URL or name of the NuGet v2 feed Package Registry. +- `<package_version>` is the package version. + +For example: + +```shell +choco install MyPackage -Source gitlab -Version 1.0.2 + +# or + +choco install MyPackage -Source "https://gitlab.example.com/api/v4/projects/<your_project_id>/packages/nuget/v2" -u <username> -p <gitlab_personal_access_token, deploy_token or job token> -Version 1.0.2 +``` + +To upgrade a package with the Chocolatey CLI: + +```shell +choco upgrade <package_id> -Source <source_url> -Version <package_version> +``` + +In this command: + +- `<package_id>` is the package ID. +- `<source_url>` is the URL or name of the NuGet v2 feed Package Registry. +- `<package_version>` is the package version. + +For example: + +```shell +choco upgrade MyPackage -Source gitlab -Version 1.0.3 +``` + +## Delete a package + +> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/38275) in GitLab 16.5. + +WARNING: +Deleting a package is a permanent action that cannot be undone. + +Prerequisites: + +- You must have the [Maintainer](../../../user/permissions.md#project-members-permissions) role or higher in the project. +- You must have both the package name and version. + +To delete a package with the NuGet CLI: + +```shell +nuget delete <package_id> <package_version> -Source <source_name> -ApiKey <gitlab_personal_access_token, deploy_token or job token> +``` + +In this command: + +- `<package_id>` is the package ID. +- `<package_version>` is the package version. +- `<source_name>` is the source name. + +For example: + +```shell +nuget delete MyPackage 1.0.0 -Source gitlab -ApiKey <gitlab_personal_access_token, deploy_token or job token> +``` + ## Symbol packages > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/262081) in GitLab 14.1. @@ -512,6 +591,8 @@ for further updates. ## Supported CLI commands +> `nuget delete` and `dotnet nuget delete` commands [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/38275) in GitLab 16.5. + The GitLab NuGet repository supports the following commands for the NuGet CLI (`nuget`) and the .NET CLI (`dotnet`): @@ -519,6 +600,8 @@ CLI (`dotnet`): - `dotnet nuget push`: Upload a package to the registry. - `nuget install`: Install a package from the registry. - `dotnet add`: Install a package from the registry. +- `nuget delete`: Delete a package from the registry. +- `dotnet nuget delete`: Delete a package from the registry. ## Example project |