Updated on 2026-08-10 GMT+08:00

Uploading and Downloading a NuGet Package via the Client

CodeArts Artifact can connect to local NuGet clients. You may upload your private packages from your local NuGet client to self-hosted repos and share them with others, who can download these NuGet packages through their clients.

NuGet Package

NuGet is the package manager for the .NET ecosystem. It enables developers to publish, share, and consume .NET libraries and components. NuGet packages are the standard format for distributing these artifacts.

Constraints

The repository password for a self-hosted repo is account-specific. If you are prompted for a password while using a different account, download the configuration file from the repository's Tutorial tab to obtain it.

Prerequisites

Uploading a NuGet Package via the Client

Ensure that you have installed the NuGet.

  1. Access self-hosted repos using your Huawei Cloud account.
  2. Select the target NuGet repository on the self-hosted repo page.
  3. Click Tutorial on the right of the page.
  4. In the displayed dialog box, set Select dependency manager to nuget.
  5. Click Download Configuration File to download the NuGet.txt configuration file.

  6. Open the downloaded file and run the following commands to add the source.

    ##----------------------NuGet add source----------------------##
    nuget sources add -name {repo_name} -source {repo_url} -username {user_name} -password {repo_password}

  7. Run the following commands to upload the package. Replace <PATH_TO_FILE> with the path of the file to be uploaded and run the upload statement. (If a configuration source exists, use the configured source name as the parameter following -source.)

    ##----------------------NuGet Download----------------------##
    nuget push <PATH_TO_FILE> -source <SOURCE_NAME>

Downloading a NuGet Package via the Client

Ensure that you have installed the NuGet.

  1. Access self-hosted repos using your Huawei Cloud account.
  2. Select the target NuGet repository on the self-hosted repo page.
  3. Click Tutorial on the right of the page.
  4. In the displayed dialog box, set Select dependency manager to nuget.
  5. Click Download Configuration File to download the NuGet.txt configuration file.

  6. Open the file, find the command under NuGet add source, and add the source.

    ##----------------------NuGet add source----------------------##
    nuget sources add -name {repo_name} -source{repo_url} -username {user_name} -password {repo_password}

  7. Open the file, find the statement under NuGet Download, replace <PACKAGE> with the name of the package to be downloaded, and run the download statement. (If a configuration source exists, use the configured source name as the parameter following -source.)

    ##----------------------NuGet Download----------------------##
    nuget install <PACKAGE>

Uploading a .NET Package via the Client

Ensure that you have installed .NET.

You can use the .NET client only after you have added the trusted server certificate.

  • To obtain the Windows trust certificate, perform the following steps:

    1. Export the server certificate.

    openssl s_client -connect {host}:443 -showcerts </dev/null 2>/dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' |openssl x509 -outform PEM >mycertfile.pem
    openssl x509 -outform der -in mycertfile.pem -out mycertfile.crt

    mycertfile.pem and mycertfile.crt are the downloaded certificates.

    2. In Windows, use PowerShell to add the certificate trust.

    Add the certificates.

    Import-Certificate -FilePath "mycertfile.crt" -CertStoreLocation cert:\CurrentUser\Root
  1. Access self-hosted repos using your Huawei Cloud account.
  2. Select the target NuGet repository on the self-hosted repo page.
  3. Click Tutorial on the right of the page.
  4. In the displayed dialog box, set Select dependency manager to dotnet.
  5. Click Download Configuration File to download the dotnet.txt configuration file.

  6. Open the configuration file, find the command under dotnet add source, and add the source.

    ##----------------------dotnet add source----------------------##
    dotnet nuget add source {repo_url} add -n {repo_name} -u {user_name} -p {repo_password}

  7. Find the statement under dotnet upload, replace <PATH_TO_FILE> with the path of the file to be uploaded, and run the upload statement.

    ##----------------------dotnet upload----------------------##
    dotnet nuget push <PATH_TO_FILE> -s {repo_name}

Downloading a .NET Package via the Client

Ensure that you have installed .NET.

  1. Access self-hosted repos using your Huawei Cloud account.
  2. Select the target NuGet repository on the self-hosted repo page.
  3. Click Tutorial on the right of the page.
  4. In the displayed dialog box, set Select dependency manager to dotnet.
  5. Click Download Configuration File to download the dotnet.txt configuration file.

  6. Open the configuration file, find the command under dotnet add source, and add the source.

    ##----------------------dotnet add source----------------------##
    dotnet nuget add source {repo_url} add -n {repo_name} -u {user_name} -p {repo_password}

  7. Find the statement under dotnet download, replace <PACKAGE> with the name of the package to be downloaded, and run the download statement.

    ##----------------------dotnet download----------------------##
    dotnet add package <PACKAGE>