Local NuGet Server
Before publishing Pragmatic.Design packages to a public registry, you’ll want
to consume them from a real project. The cleanest path is a local NuGet server:
packages are dotnet packed from the monorepo, pushed to the local server,
and consumed from test projects exactly as they would be from nuget.org.
This guide covers BaGetter, a community-maintained fork of BaGet with current dependency updates.
Prerequisites
Section titled “Prerequisites”- Docker Desktop (Windows) or Docker Engine (Linux/macOS)
- The Pragmatic.Design repository checked out locally
1. Run BaGetter
Section titled “1. Run BaGetter”docker run --rm --name bagetter \ -p 5555:8080 \ -v $PWD/.bagetter-data:/data \ -e ApiKey=dev-key \ -e Storage__Type=FileSystem \ -e Storage__Path=/data/packages \ -e Database__Type=Sqlite \ -e Database__ConnectionString="Data Source=/data/bagetter.db" \ -e Search__Type=Database \ bagetter/bagetter:latestBaGetter is now available at http://localhost:5555.
Open it in a browser to verify the UI loads.
2. Add the local feed to NuGet config
Section titled “2. Add the local feed to NuGet config”Create or update NuGet.Config at the repo root (the file already exists; add
the BaGetter source to it):
<packageSources> <add key="local-bagetter" value="http://localhost:5555/v3/index.json" /> <add key="nuget.org" value="https://api.nuget.org/v3/index.json" /></packageSources>Or register it globally once:
dotnet nuget add source http://localhost:5555/v3/index.json --name local-bagetter3. Pack from the monorepo
Section titled “3. Pack from the monorepo”From the repo root:
dotnet pack Pragmatic.Design.slnx --configuration Release --output ./artifactsPackages land under ./artifacts/ with their MinVer-resolved version
(e.g. Pragmatic.Result.0.1.0-preview.0.984.nupkg).
4. Push to BaGetter
Section titled “4. Push to BaGetter”for pkg in ./artifacts/*.nupkg; do dotnet nuget push "$pkg" \ --source http://localhost:5555/v3/index.json \ --api-key dev-key \ --skip-duplicatedone.snupkg (symbol packages) are pushed the same way — BaGetter handles
symbol server endpoints automatically.
5. Consume from a test project
Section titled “5. Consume from a test project”In any test project’s .csproj:
<ItemGroup> <PackageReference Include="Pragmatic.Result" Version="0.1.0-preview.*" /></ItemGroup>Then:
dotnet restoreNuGet resolves the reference from BaGetter first (local) and falls back to nuget.org if not found.
Bumping a version during testing
Section titled “Bumping a version during testing”MinVer derives the version from the most recent nuget-v* tag plus commit
height. To test a specific version:
# Tag locally (not pushed to origin)git tag nuget-v0.1.0-preview.1
# Pack again — packages now versioned 0.1.0-preview.1dotnet pack Pragmatic.Design.slnx --configuration Release --output ./artifacts
# Push to BaGetterfor pkg in ./artifacts/*.nupkg; do dotnet nuget push "$pkg" --source http://localhost:5555/v3/index.json --api-key dev-key --skip-duplicatedone
# When done, remove the local taggit tag -d nuget-v0.1.0-preview.1Clearing the feed
Section titled “Clearing the feed”If you need a fresh state (e.g. you pushed a broken build):
docker stop bagetterrm -rf .bagetter-dataThen restart the container.
Troubleshooting
Section titled “Troubleshooting”“Package already exists” — BaGetter rejects re-pushes of the exact same
version. Either bump (new commit ⇒ new MinVer height) or use
--skip-duplicate.
NuGet.exe restore finds old version from cache — clear the local cache:
dotnet nuget locals all --clearPackage missing README / LICENSE — Directory.Build.props packs them
automatically. If a module lacks its own README, the repo-root README is
used as fallback.