Skip to content

NuGet Package

Wei Lin edited this page Mar 2, 2026 · 2 revisions

NuGet Package

MiniPdf is published to NuGet.org and can be installed via the .NET CLI.

Install

dotnet add package MiniPdf

Package Metadata

Property Value
Package ID MiniPdf
Authors shps951023
License Apache-2.0
Tags pdf, excel, xlsx, converter, text, minipdf
Repository https://github.com/shps951023/MiniPdf

Metadata is defined in src/MiniPdf/MiniPdf.csproj.

How Publishing Works

Publishing is fully automated via GitHub Actions (nuget-publish.yml).

Workflow Trigger

The workflow runs automatically when a GitHub Release is published.

Pipeline Steps

  1. Checkout code
  2. Setup .NET 9.0
  3. dotnet restore
  4. dotnet build --configuration Release
  5. dotnet test — all tests must pass
  6. Extract version from the release tag (e.g. v0.2.00.2.0)
  7. dotnet pack with the extracted PackageVersion
  8. dotnet nuget push to NuGet.org

CI Pack Verification

The main CI workflow (ci.yml) also runs dotnet pack on every push/PR to verify the package can be built correctly.

How to Publish a New Version

  1. Update the version in src/MiniPdf/MiniPdf.csproj:
    <Version>0.2.0</Version>
    <PackageVersion>0.2.0</PackageVersion>
  2. Commit and push to main
  3. Create a GitHub Release:
    • Go to Releases → Draft a new release
    • Create a new tag matching the version: v0.2.0
    • Title: v0.2.0
    • Add release notes (or click "Generate release notes")
    • Click Publish release
  4. The NuGet Publish workflow triggers automatically and pushes the package to NuGet.org

Required Secret

Secret Description
NUGET_API_KEY NuGet.org API key with Push scope for the MiniPdf package

How to create the API key

  1. Sign in to https://www.nuget.org
  2. Go to API KeysCreate
  3. Set glob pattern to MiniPdf, scope to Push
  4. Copy the key
  5. In the GitHub repo: Settings → Secrets and variables → Actions → New repository secret
    • Name: NUGET_API_KEY
    • Value: paste the key

Troubleshooting

MSB4044: PackageVersion not set

If the CI runner uses .NET 10+, the GetPackOutputItemsTask requires <PackageVersion> to be explicitly defined in the .csproj. Make sure both <Version> and <PackageVersion> are set:

<Version>0.1.0</Version>
<PackageVersion>0.1.0</PackageVersion>

Package already exists (409 Conflict)

The workflow uses --skip-duplicate, so re-publishing the same version is a no-op (not an error).

Clone this wiki locally