Skip to content

Latest commit

 

History

History
117 lines (78 loc) · 2.56 KB

File metadata and controls

117 lines (78 loc) · 2.56 KB

Publishing to NuGet.org

This document describes how to publish the Sirv.RestApi package to NuGet.org.

Prerequisites

  1. .NET SDK 6.0 or later
  2. A NuGet.org account
  3. A NuGet API key from nuget.org/account/apikeys

Build the Package

Using the build script (Linux/macOS)

chmod +x build.sh
./build.sh

Using the build script (Windows)

.\build.ps1

Manual build

# Restore dependencies
dotnet restore

# Build in Release mode
dotnet build -c Release

# Create NuGet package
dotnet pack -c Release -o ./artifacts

Verify the Package

Before publishing, verify the package contents:

# List package contents
dotnet nuget inspect ./artifacts/Sirv.RestApi.1.0.0.nupkg

Publish to NuGet.org

Option 1: Using dotnet CLI

dotnet nuget push ./artifacts/Sirv.RestApi.1.0.0.nupkg \
    --api-key YOUR_NUGET_API_KEY \
    --source https://api.nuget.org/v3/index.json

Option 2: Using NuGet CLI

nuget push ./artifacts/Sirv.RestApi.1.0.0.nupkg \
    -ApiKey YOUR_NUGET_API_KEY \
    -Source https://api.nuget.org/v3/index.json

Option 3: Manual Upload

  1. Go to nuget.org/packages/manage/upload
  2. Drag and drop the .nupkg file
  3. Verify the package details
  4. Click "Submit"

Package Metadata

The package includes the following metadata (configured in Sirv.RestApi.csproj):

Updating the Version

To release a new version:

  1. Update the <Version> in src/Sirv.RestApi/Sirv.RestApi.csproj
  2. Update <PackageReleaseNotes> with changes
  3. Build and publish as described above

Symbol Package

The SDK is configured to generate symbol packages (.snupkg) for better debugging experience. These are automatically uploaded alongside the main package when using dotnet nuget push.

Troubleshooting

"Package already exists"

If you see this error, the version already exists on NuGet.org. Increment the version number in the .csproj file.

"API key is invalid"

Ensure your API key:

  • Has not expired
  • Has the "Push" scope
  • Is associated with the correct account

Build errors

Ensure you have the correct .NET SDK installed:

dotnet --list-sdks

The SDK requires .NET 6.0 or later for building.