Quader Docs 0.176.0

NuGet

Restore, push and maintain NuGet packages with the .NET CLI, nuget.exe and Visual Studio, and set up the repositories they use.

On this page

Configure the client

A NuGet client takes the repository's service index, <base URL>/api/nuget/<project>/<repository>/v3/index.json, as a package source. Quader serves NuGet v3 only; a v2 address answers 404 and names the service index.

Client How Credential
.NET CLI dotnet nuget add source <service index> --name quader …, or a nuget.config beside the solution --username quader --password "${QUADER_TOKEN}" --store-password-in-clear-text, or %QUADER_TOKEN% in the file
nuget.exe nuget sources add -Name quader -Source <service index> …, or the nuget.config -Username quader -Password %QUADER_TOKEN%; on Linux and macOS add -StorePasswordInClearText
Visual Studio 2022 The nuget.config beside the solution %QUADER_TOKEN% from the environment Visual Studio started in, or the credential prompt with the token as the password
xml
<!-- nuget.config, example: the virtual repository nuget of the project web -->
<configuration>
  <packageSources>
    <clear />
    <add key="quader" value="https://quader.example.com/api/nuget/web/nuget/v3/index.json" protocolVersion="3" />
  </packageSources>
  <packageSourceCredentials>   <!-- only when the repository is not public -->
    <quader>
      <add key="Username" value="quader" />
      <add key="ClearTextPassword" value="%QUADER_TOKEN%" />
    </quader>
  </packageSourceCredentials>
</configuration>

The user name is not checked. NuGet cannot encrypt a stored password on Linux and macOS, so the command form writes the expanded token into the user-level file; the nuget.config form keeps the reference %QUADER_TOKEN% and can be committed. <clear /> drops every other source, nuget.org too, so no public package of the same ID slips in: put a remote of nuget.org into the virtual repository instead. Where several sources stay, package source mapping says which may serve which ID prefix; the guide shows it.

Restore, push and maintain

shell
dotnet add package <id> --version <version>     # nuget install <id> -Version <version> -Source quader
dotnet restore                                  # nuget restore; add --no-http-cache after a push
dotnet restore --locked-mode                    # nuget restore -LockedMode
dotnet nuget push <file>.nupkg --source <service index> --api-key "${QUADER_TOKEN}"
dotnet nuget delete <id> <version> --source <service index> --api-key "${QUADER_TOKEN}" --non-interactive   # unlist or delete
nuget push <file>.nupkg -Source <service index> -ApiKey %QUADER_TOKEN%     # nuget.exe; delete alike

The token is the API key for push, unlist, relist and delete, and the password for everything else; an API key on the command line shows in the process list while the command runs. Visual Studio installs through Manage NuGet Packages and does not push. Without a client, Upload package in the toolbar of a local or virtual repository's page takes a .nupkg and, if you like, its .snupkg, and runs every check of a push.

Restoring needs read, pushing and relisting deploy, unlisting and deleting delete; through a virtual repository you also need read on the members you restore from.

Class What a client meets
Local An ID and version is pushed once: other bytes answer 409 nuget_version_exists, the same file again succeeds unchanged. A number deleted for good stays blocked (409 nuget_version_deleted). A .snupkg is stored with its version
Remote No writes (405); version lists and registrations are asked again after the metadata period
Virtual Push, unlist, relist and delete go to the deployment target; without one 405 no_deploy_target

Unlisting, what dotnet nuget delete does by default, hides a version from search; a project that names it still restores it, and its page shows Unlisted. NuGet has no command to list a version again; the guide shows the request. The first push of an ID claims it for the local repository, as for npm (Protection against dependency confusion).

packages.lock.json (switched on with RestorePackagesWithLockFile) records each package's content hash and no source, so it moves to another repository that serves the same bytes. A failed push prints the status only; curl shows the code in the body, and the guide's troubleshooting table explains each.

Visual Studio and the package page show the icon, licence and README a package embeds; a remote has them for the versions it cached.

What an endpoint with exposure rules serves of NuGet is on Endpoints.

Settings

Who
the project's Owner, and holders of repositories:write-config

A remote starts at nuget.org (https://api.nuget.org/v3/index.json, further hosts *.nuget.org), with a metadata period of 300 seconds and a remembered "not found" of 1,800 seconds. The format's own settings are in NuGet settings:

Class Setting Default What it does
Local Delete mode Unlist What a client's delete does: Unlist, or Delete for good, which keeps the number blocked. A delete in the UI or the API always removes
Remote Forward search on Passes searches to the upstream, so clients find packages nobody fetched yet; off answers from the cache and no search term leaves your network
Every class Vulnerability information Automatic From Quader's advisory data lists it in the service index, so dotnet restore reports known vulnerabilities (NU1901 to NU1904); Off lists nothing

Automatic takes Quader's advisory data while vulnerability scanning is on and its OSV source is not off. The installation's limits of a package and of search are the keys of nuget.

Not available

  • NuGet v2 addresses.
  • Autocomplete and the symbol server for debuggers answer 501.