This guide helps you migrate from AutoRest to modern, actively maintained code generators. Choose the option that best fits your needs:
Best for: Traditional HttpClient-based REST clients with full control over HTTP communication.
Benefits:
- Battle-tested and widely used in production
- Comprehensive feature set with extensive configuration options
- Active development and community support
- Similar output style to AutoRest
- Built-in dependency injection support
How to migrate:
- In Visual Studio, change the custom tool from
AutoRestCodeGeneratortoNSwagCodeGenerator - In CLI, use
rapicgen csharp nswaginstead ofrapicgen csharp autorest - Review and update any AutoRest-specific configuration options
Example CLI:
# Before (AutoRest)
rapicgen csharp autorest swagger.json GeneratedCode Output.cs
# After (NSwag)
rapicgen csharp nswag swagger.json GeneratedCode Output.csBest for: Projects using or wanting to use Refit for type-safe REST clients.
Benefits:
- Generates Refit interfaces instead of full implementations
- Cleaner, more maintainable interface-based code
- Excellent for testing and mocking
- Built on top of NSwag for contract generation
- Actively maintained with frequent updates
How to migrate:
- Add the Refit NuGet package to your project
- In Visual Studio, change the custom tool to
RefitterCodeGenerator - In CLI, use
rapicgen csharp refitter - Update client instantiation code to use
RestService.For<IApiClient>(httpClient)
Example CLI:
# Before (AutoRest)
rapicgen csharp autorest swagger.json GeneratedCode Output.cs
# After (Refitter)
rapicgen csharp refitter swagger.json GeneratedCode Output.csBest for: Microsoft Graph API and other Microsoft services, or projects wanting modern async-first patterns.
Benefits:
- Official Microsoft replacement for AutoRest
- Modern, async-first design
- Excellent for Microsoft Graph and Azure APIs
- Built-in middleware pipeline support
- Active Microsoft support
How to migrate:
- Add required Kiota NuGet packages (see Dependencies below)
- In Visual Studio, change the custom tool to
KiotaCodeGenerator - In CLI, use
rapicgen csharp kiota - Update client instantiation to use Kiota's builder pattern
Example CLI:
# Before (AutoRest)
rapicgen csharp autorest swagger.json GeneratedCode Output.cs
# After (Kiota)
rapicgen csharp kiota swagger.json GeneratedCode Output.cs| Feature | AutoRest | NSwag | Refitter | Kiota |
|---|---|---|---|---|
| Status | ✅ Active | ✅ Active | ✅ Active | |
| OpenAPI 3.x Support | Partial | ✅ Full | ✅ Full | ✅ Full |
| Async/Await | ✅ | ✅ | ✅ | ✅ |
| Dependency Injection | ✅ | ✅ | ✅ | ✅ |
| Single File Output | ✅ | ✅ | ✅ | ✅ |
| Contract Generation | ✅ | ✅ | ✅ | ✅ |
| Interface-based | ❌ | ❌ | ✅ | ❌ |
| Middleware Pipeline | Limited | ✅ | Via HttpClient | ✅ Built-in |
| Testing Support | Good | Good | Excellent | Good |
- Newtonsoft.Json 13.0.3+
- Refit 9.0.2+
- Microsoft.Kiota.Abstractions
- Microsoft.Kiota.Http.HttpClientLibrary
- Microsoft.Kiota.Serialization.Form
- Microsoft.Kiota.Serialization.Json
- Microsoft.Kiota.Serialization.Text
- Microsoft.Kiota.Serialization.Multipart
- Now through June 2026: AutoRest remains functional with deprecation warnings
- July 1, 2026: Microsoft retires AutoRest
- Future major version (estimated Q3-Q4 2026): AutoRest support removed from this tool
If you encounter issues during migration:
-
Review the generator-specific documentation:
-
Check the project issues for known migration challenges
-
Create a new issue if you need assistance with your specific use case