This document describes how to store NuGet artifacts in CODING-AR for centralized artifact management and version control. The following sections introduce how to create an artifact repository and NuGet package, pull and push artifacts, and configure proxies.
Open CODING-AR
1. Log in to the CODING Console and click Use Now to go to CODING page.
2. Click in the upper-right corner to open the project list page and click a project icon to open the project. 3. In the menu on the left, click Artifact Management.
Preparations
Note:
Before you begin:
Install NuGet.
Select NuGet as the repository type.
Initialize a NuGet Artifact (Optional)
Generate a NuGet artifact locally
You can skip this section if you are familiar with NuGet artifacts.
1. Create a demo directory.
mkdir nuget-demo && cd nuget-demo
2. Create a .nuspec
package.
nuget spec [Artifact Name]
3. Package the artifact.
nuget pack <Artifact Name>.nuspec
4. After the artifact is packaged, you can view the package file generated in the local directory.
Pull an artifact from an online source
Visit the NuGet website, search for a NuGet artifact, and download it or pull it via the command line.
Pull an artifact via the command line:
nuget install [Artifact Name] -OutputDirectory packages
Authentication information must be configured before you can pull artifacts from or push artifacts to CODING-AR. The following example uses automatic configuration.
Click Generate configuration from access token and enter your password to obtain the configuration command. Then, copy and run the command in the directory where the NuGet artifact is stored. During this process, permission control is implemented with the personal access token.
Replace the variables and run the command push an artifact.
nuget push -ApiKey api -Source [Repository name in the push guide] [Local artifact name].nupkg
Replace the variables and run the command pull an artifact.
nuget install -Source [Repository name in the pull guide] -Version [Artifact Version] [Artifact Name]
If you try to pull an artifact that does not exist in the CODING private repository, the system will try to pull from the configured proxy. You can add a third-party artifact source to obtain artifacts from the specific repository. Without the need for configuration, CODING will retrieve artifacts in sequence from top to bottom.
Run the following command to pull an artifact:
nuget install -Source [Repository Name] -Version [Artifact Version] [Artifact Name]
The artifact and its dependencies will be pulled to the local machine and synchronized to CODING-AR. The package source will be shown on the details page.
Note:
If CODING-AR does not automatically store NuGet artifacts pulled from the proxy, check:
Whether you have the permission to push artifacts to this repository.
Whether the artifacts already exist in your local cache.
Was this page helpful?