cacheport

Ecosystem · .NET

NuGet package cache for CI

Cacheport exposes a NuGet V3 feed that mirrors nuget.org. Clear the default sources in nuget.config, add Cacheport, and dotnet restore pulls from your region.

CP-NUGETManifest
Upstream
api.nuget.org, plus feeds you add
Endpoint
https://acme.cacheport.cc/nuget/v3/index.json
Config
nuget.config
Credentials
%CACHEPORT_TOKEN% in packageSourceCredentials
Lock files
packages.lock.json unchanged
Packages
Cached forever, immutable

How NuGet caching works

NuGet V3 feeds start from a service index that points to the resources a client needs: package metadata, the flat container with .nupkg files, and search. Cacheport implements the restore-related resources and caches packages permanently.

Packages are served unmodified, so the content hashes in packages.lock.json keep matching and signed packages keep their signatures.

What gets cached
Registration metadata
Refreshed every 5 minutes.
.nupkg files
Cached forever, signatures intact.
Search
Passed through to the upstream.

Set it up

nuget.config

nuget.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <clear />
    <add key="cacheport" value="https://acme.cacheport.cc/nuget/v3/index.json" />
  </packageSources>
  <packageSourceCredentials>
    <cacheport>
      <add key="Username" value="ci" />
      <add key="ClearTextPassword" value="%CACHEPORT_TOKEN%" />
    </cacheport>
  </packageSourceCredentials>
</configuration>

NuGet expands %CACHEPORT_TOKEN% from the environment on every platform. The <clear /> element removes nuget.org so nothing goes around the cache.

Use it in CI

Store the token as a secret named CACHEPORT_TOKEN, then pick your provider.

GitHub Actions

.github/workflows/ci.yml
jobs:
  build:
    runs-on: ubuntu-latest
    env:
      CACHEPORT_TOKEN: ${{ secrets.CACHEPORT_TOKEN }}
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-dotnet@v4
        with:
          dotnet-version: 8.0.x
      - run: dotnet restore --locked-mode
      - run: dotnet test --no-restore

More for GitHub Actions: GitHub Actions setup guide.

GitLab CI

.gitlab-ci.yml
build:
  image: mcr.microsoft.com/dotnet/sdk:8.0
  script:
    - dotnet restore --locked-mode
    - dotnet test --no-restore

More for GitLab CI: GitLab CI setup guide.

Package source mapping

If you use several feeds, NuGet's package source mapping decides which feed serves which package IDs. With Cacheport you can keep mapping simple: add private feeds as upstreams of the workspace and map everything to the single Cacheport source.

Troubleshooting

Errors that usually mean the public registry is the bottleneck, and what Cacheport changes about them.

Questions

Does it work with packages.config projects?

Yes. nuget.exe and MSBuild restore read the same nuget.config.

Can I push packages to Cacheport?

No. Push to nuget.org or your private feed; Cacheport is read-only.

Are symbol packages cached?

Not by default. Symbol servers are a separate service and are passed through.

Other ecosystems people set up next

Start on the free plan

20 GB of cache, every registry, unlimited users. Upgrade when your pipelines outgrow it.