Skip to content

Configure, publish to, and restore from NuGet v3 ​

NuGet discovers the publishing, registration, and flat container endpoints in its v3 service index. Arka accepts the .NET 8 native push path /api/v2/package/ and its form without a trailing slash.

Create repositories ​

Run these Bash commands with an authenticated administrator arkactl profile and jq. Replace the example address with your HTTPS endpoint. Publish to Hosted. Group looks in Hosted first, then in Proxy. Grant the publishing account write access to Hosted and the consuming account read access to Group and the relevant members.

For each consuming or publishing identity, sign in with its profile and run arkactl --json tokens create --name nuget-ci --expires-in-days 30 | jq -er .plaintext. Send the output directly to the CI secret store. Use a separate read and write token for the examples below.

bash
export ARKA_URL=https://packages.example.org
hosted=$(arkactl --json repo create --name nuget-hosted --type hosted --format nuget | jq -er .id)
proxy=$(arkactl --json repo create --name nuget-proxy --type proxy --format nuget \
  --upstream-url https://api.nuget.org/v3/index.json | jq -er .id)
arkactl repo create --name nuget-group --type group --format nuget --member "$hosted,$proxy"
WRITE="$ARKA_URL/repository/nuget-hosted"
READ="$ARKA_URL/repository/nuget-group"

Configure NuGet.Config ​

xml
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <clear />
    <add key="arkaRead" value="https://packages.example.org/repository/nuget-group/v3/index.json" protocolVersion="3" />
    <add key="arkaWrite" value="https://packages.example.org/repository/nuget-hosted/v3/index.json" protocolVersion="3" />
  </packageSources>
</configuration>

Use Basic for private reads. CI supplies source credentials through environment variables. dotnet nuget push sends the publishing token in X-NuGet-ApiKey.

bash
export NuGetPackageSourceCredentials_arkaRead="Username=$ARKA_USER;Password=$ARKA_READ_TOKEN;ValidAuthenticationTypes=Basic"
export NuGetPackageSourceCredentials_arkaWrite="Username=$ARKA_USER;Password=$ARKA_WRITE_TOKEN;ValidAuthenticationTypes=Basic"
dotnet pack -c Release -o dist
dotnet nuget push dist/Widget.1.2.3.nupkg --source arkaWrite --api-key "$ARKA_WRITE_TOKEN"

You can also upload the raw nupkg directly to the Hosted repository’s NuGet endpoint and restore with an empty cache.

bash
curl -fsS -H "X-NuGet-ApiKey: $ARKA_WRITE_TOKEN" \
  -T dist/Widget.1.2.3.nupkg "$WRITE/api/v2/package"
# The consuming project must declare a PackageReference for Widget.
NUGET_PACKAGES="$(mktemp -d)" dotnet restore App.csproj --configfile NuGet.Config \
  --source "$READ/v3/index.json" --no-cache
SymptomWhat to check
Native push returns 400Inspect the publish URL in the v3 index and verify that the uploaded nupkg is valid.
NU1301 or a sign-in pageCheck that v3/index.json returns JSON with resources. Match the credential variable suffix to the source name and casing.
Package ID is visible but restore fails for this versionInspect v3-flatcontainer/widget/index.json and the nupkg in its version directory as the consuming account. Check whether different bytes were published under the same version.

NuGet.Config and credentials

Released under the Apache 2.0 License.