Kiota.Tools
0.1.0
dotnet add package Kiota.Tools --version 0.1.0
NuGet\Install-Package Kiota.Tools -Version 0.1.0
<PackageReference Include="Kiota.Tools" Version="0.1.0"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
<PackageVersion Include="Kiota.Tools" Version="0.1.0" />
<PackageReference Include="Kiota.Tools"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add Kiota.Tools --version 0.1.0
#r "nuget: Kiota.Tools, 0.1.0"
#:package Kiota.Tools@0.1.0
#addin nuget:?package=Kiota.Tools&version=0.1.0
#tool nuget:?package=Kiota.Tools&version=0.1.0
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:
$(KiotaToolPath)— explicit path wins- Local .NET tool —
dotnet tool run kiota(reads.config/dotnet-tools.json) - Global .NET tool —
kiotaonPATH - Auto-install — runs
dotnet tool install -g Microsoft.OpenApi.Kiotawith 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
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 |