Kiota.Tools 0.1.0

dotnet add package Kiota.Tools --version 0.1.0
                    
NuGet\Install-Package Kiota.Tools -Version 0.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Kiota.Tools" Version="0.1.0">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Kiota.Tools" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Kiota.Tools">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Kiota.Tools --version 0.1.0
                    
#r "nuget: Kiota.Tools, 0.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Kiota.Tools@0.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Kiota.Tools&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Kiota.Tools&version=0.1.0
                    
Install as a Cake Tool

Kiota.Tools

Generate strongly-typed REST API clients from OpenAPI specs automatically at build time — no manual codegen step, no checked-in generated code.

Inspired by Grpc.Tools: reference the package, point at your spec, build.


Quick start


<ItemGroup>
    <PackageReference Include="Kiota.Tools" Version="1.0.0" />
</ItemGroup>

<ItemGroup>
    <KiotaOpenApiSpec Include="openapi.yaml">
        <Namespace>MyApp.ApiClient</Namespace>
        <ClientClassName>MyApiClient</ClientClassName>
    </KiotaOpenApiSpec>
</ItemGroup>
dotnet build    # client generated into obj/generated/*
var adapter = new HttpClientRequestAdapter(new AnonymousAuthenticationProvider());
var client  = new MyApiClient(adapter);

var pets = await client.Pets.GetAsync();

That should™ be it.


How it works

dotnet build
    │
    ├─ BeforeTargets="CoreCompile"
    │       KiotaRunGenerate
    │           └─ kiota generate --language CSharp
    │                   --openapi openapi.yaml
    │                   --output  obj/generated/openapi/
    │                   --namespace-name MyApp.ApiClient
    │                   --class-name MyApiClient
    │
    ├─ AfterTargets="KiotaRunGenerate"
    │       KiotaAddGeneratedFilesToCompile
    │           └─ <Compile Include="obj/generated/**/*.cs" />
    │
    └─ CoreCompile  ← generated files already in Compile item group

Generation uses stamp files (obj/generated/<specname>.stamp) for incremental builds — kiota only runs when the spec changes.


Reference

Item metadata

Metadata Default Description
Namespace $(RootNamespace) C# namespace for the generated code
ClientClassName ApiClient Name of the top-level client class
OutputSubPath spec filename (no ext) Sub-folder under $(KiotaOutputPath)
IncludePaths (all paths) Semi-colon separated globs, e.g. /pets/**;/owners/**
ExcludePaths (none) Semi-colon separated globs

Properties

Property Default Description
KiotaOutputPath $(BaseIntermediateOutputPath)generated/ Root folder for all generated files
KiotaCleanOutput true Clean output directory before each generation
KiotaGenerateClients true Set to false to disable generation globally
KiotaToolPath (auto-resolved) Explicit path to the kiota binary

Multiple specs

<ItemGroup>
  <KiotaOpenApiSpec Include="weather-api.yaml">
    <Namespace>MyApp.Weather</Namespace>
    <ClientClassName>WeatherClient</ClientClassName>
  </KiotaOpenApiSpec>

  <KiotaOpenApiSpec Include="payments-api.yaml">
    <Namespace>MyApp.Payments</Namespace>
    <ClientClassName>PaymentsClient</ClientClassName>
  </KiotaOpenApiSpec>
</ItemGroup>

Each spec gets its own sub-folder and stamp file under obj/generated/, so incremental builds track them independently.


kiota tool resolution

The package locates kiota in this order:

  1. $(KiotaToolPath) — explicit path wins
  2. Local .NET tool — dotnet tool run kiota (reads .config/dotnet-tools.json)
  3. Global .NET tool — kiota on PATH
  4. Auto-install — runs dotnet tool install -g Microsoft.OpenApi.Kiota with a warning

For CI, a local tool manifest is recommended so the version is pinned:

dotnet new tool-manifest
dotnet tool install Microsoft.OpenApi.Kiota
git commit .config/

CI then just needs dotnet tool restore before the first build.


Generated file layout

obj/
└── generated/                        ← KiotaOutputPath (covered by .gitignore via obj/)
    └── openapi/                      ← OutputSubPath (spec filename, no extension)
        ├── ApiClient.cs              ← top-level client (ClientClassName)
        ├── Models/
        │   ├── Pet.cs
        │   └── Error.cs
        └── Pets/
            ├── PetsRequestBuilder.cs
            └── Item/
                └── PetsItemRequestBuilder.cs
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0 164 3/10/2026