Skip to navigation

Publish C# SDKs generated in Postman

View as Markdown

SDK generation in Postman has moved. Postman SDK Generator has been consolidated into Fern, Postman’s official SDK and documentation engine, which delivers idiomatic, type-safe client libraries and automated publishing across the API lifecycle. No more updates will be made to Postman SDK Generator—all new SDK capabilities are delivered in Fern as part of the Postman platform. See the Fern SDK documentation to get started, or follow the migration guide to upgrade your existing configuration.

This guide covers publishing generated C# SDKs. For information on automating C# SDK publishing, see Publish C# SDKs automatically.

Publishing your SDK to NuGet.org makes it available to any .NET developer using dotnet add package.

Prerequisites

To publish your SDK to NuGet, you need the following:

  • A NuGet.org account.
  • An API key from your NuGet account settings.

Configure the project file

The generated [SdkName].csproj already includes the metadata required for publishing. Review and update the following fields before publishing.

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<PackageId>YourSdk</PackageId>
<Version>1.0.0</Version>
<Authors>Your Name</Authors>
<Description>SDK for Your API</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/your-org/your-sdk</PackageProjectUrl>
<RepositoryUrl>https://github.com/your-org/your-sdk</RepositoryUrl>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
</Project>

Publish your C# SDK to NuGet

To publish your SDK to NuGet, do the following:

  1. Build and pack the SDK.

    cd path/to/your-sdk
    dotnet pack -c Release -o ./nupkgs
  2. Publish to NuGet.

    dotnet nuget push ./nupkgs/YourSdk.1.0.0.nupkg \
    --api-key YOUR_NUGET_API_KEY \
    --source https://api.nuget.org/v3/index.json
  3. Verify the publication at https://www.nuget.org/packages/YourSdk. Packages are typically indexed within 15 to 30 minutes.

Publish updates

To publish updates to your SDK, run the following:

# Update the version in your .csproj
# Then pack and push
dotnet pack -c Release -o ./nupkgs
dotnet nuget push ./nupkgs/YourSdk.1.0.1.nupkg \
--api-key YOUR_NUGET_API_KEY \
--source https://api.nuget.org/v3/index.json

Best practices for publishing C# SDKs

Use the following best practices when publishing your C# SDK to NuGet:

  • Use semantic versioning.
  • Generate and include XML documentation by setting <GenerateDocumentationFile>true</GenerateDocumentationFile> in your .csproj file.
  • Tag releases in Git.
  • Include a .snupkg symbols package for debugging support by adding <IncludeSymbols>true</IncludeSymbols> and <SymbolPackageFormat>snupkg</SymbolPackageFormat>.