tencent cloud

Feedback

NuGet Repository

Last updated: 2022-03-30 10:08:16

    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.
    • Create an artifact repository (see Basic Operations).
    • Select NuGet as the repository type.

    Initialize a NuGet Artifact (Optional)

    Visit the NuGet website to and download and install NuGet.

    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

    Configure Authentication Information

    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.

    Push an Artifact

    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

    Pull an Artifact

    Replace the variables and run the command pull an artifact.

    nuget install -Source [Repository name in the pull guide] -Version [Artifact Version] [Artifact Name]

    Configure a Proxy

    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:

    1. Whether you have the permission to push artifacts to this repository.
    2. Whether the artifacts already exist in your local cache.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support