AutoSDK
Getting Started

Installation

Set up the AutoSDK CLI tool or Roslyn source generator for your .NET project.

AutoSDK offers two generation modes: a CLI tool for on-demand generation and a source generator NuGet package for compile-time integration.

The CLI is the most flexible option — it works with any project structure and integrates easily into CI/CD.

dotnet tool install --global autosdk.cli --prerelease

Requirements

  • .NET SDK 8.0 or later
  • Works on Windows, macOS, and Linux

Verify Installation

autosdk --version
autosdk --help

Update

dotnet tool update --global autosdk.cli --prerelease

Source Generator (NuGet Package)

For compile-time generation, add AutoSDK as a source generator to your .csproj:

<ItemGroup>
  <PackageReference Include="AutoSDK" Version="*-*" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
  <AdditionalFiles Include="openapi.yaml" />
</ItemGroup>

Configuration via MSBuild Properties

Configure generation behavior through MSBuild properties in your .csproj:

<PropertyGroup>
  <AutoSDK_Namespace>MyCompany.MyApi</AutoSDK_Namespace>
  <AutoSDK_ClassName>MyApiClient</AutoSDK_ClassName>
  <AutoSDK_GenerateConstructors>true</AutoSDK_GenerateConstructors>
  <AutoSDK_GenerateMethods>true</AutoSDK_GenerateMethods>
  <AutoSDK_GenerateModels>true</AutoSDK_GenerateModels>
</PropertyGroup>

See Configuration Properties for the full list.

Trimming/NativeAOT with Source Generator

The source generator requires a two-project pattern for trimming support. See Trimming & NativeAOT for details.

Scaffold a Complete SDK Project

Use autosdk init to scaffold a full SDK project with solution, CI workflows, tests, and docs:

autosdk init PetStore PetStoreClient \
  "https://petstore3.swagger.io/api/v3/openapi.json" \
  MyCompany \
  --add-mkdocs --add-tests

This creates:

PetStore/
├── PetStore.slnx
├── src/
│   ├── libs/PetStore/
│   │   ├── PetStore.csproj
│   │   ├── openapi.yaml
│   │   ├── generate.sh
│   │   └── Generated/
│   └── tests/IntegrationTests/
└── .github/workflows/
Edit on GitHub

Last updated on

On this page