Visual Studio Integration

REST API Client Code Generator provides seamless integration across all major Visual Studio platforms with consistent functionality and user experience.

Add new REST API Client menu option

Add a new REST API Client directly from the Visual Studio Add menu

REST API Client configuration dialog

Configure your OpenAPI specification URL, namespace, and code generator

Supported Platforms

  • Visual Studio 2017, 2019, 2022 - Full integration with all modern Visual Studio versions
  • Visual Studio Code - Context menu integration for JSON and YAML files
  • Visual Studio for Mac - Complete feature parity across platforms
Solution Explorer context menu options

Right-click context menu options in Solution Explorer for quick access to code generation

Code Generators

Custom Tools

Custom tools let you associate a tool with an item in a project and run that tool whenever the file is saved, enabling automatic code regeneration when your OpenAPI specifications change.

NSwagCodeGenerator

Version: v14.4.0

Generates a single file C# REST API Client using the NSwag.CodeGeneration.CSharp NuGet package. Produces clean, strongly-typed code with full async support and comprehensive error handling.

Key Features:

  • Strongly-typed client generation
  • Full async/await support
  • Comprehensive exception handling
  • Integration with ASP.NET Core

OpenApiCodeGenerator

Version: v7.14.0

Generates a single file C# REST API Client using OpenAPI Generator. The output file merges all generated files using the command: generate -g csharp --input-spec [swagger file] --output [output file] -DapiTests=false -DmodelTests=false -DpackageName=[namespace] --skip-overwrite

Configuration Options:

  • Generate Multiple Files support
  • Extensive customization properties
  • Template customization
  • Multiple output formats

KiotaCodeGenerator

Version: v1.27.0

Generates a single file C# REST API Client using Microsoft Kiota. The output merges files generated with: generate -l CSharp -d [swagger file] -o [output file] -n [namespace]

Microsoft Integration:

  • Microsoft Graph API support
  • Azure authentication patterns
  • Modern .NET practices
  • Strong typing and validation

SwaggerCodeGenerator

Version: v3.0.34

Generates a single file C# REST API Client using Swagger Codegen CLI. Uses the command: generate -l csharp --input-spec [swagger file] --output [output file] -DapiTests=false -DmodelTests=false -DpackageName=[namespace] --skip-overwrite

Proven Reliability:

  • Extensive language support
  • Legacy project compatibility
  • Established workflow integration
  • Community-driven templates

AutoRestCodeGenerator

Version: v3.0.0-beta.20210504.2 (v3), v2.0.4417 (v2)

Generates a single file C# REST API Client using AutoRest. Equivalent to: --csharp --input-file=[swagger file] --output-file=[output file] --namespace=[namespace] --add-credentials

Enterprise Features:

  • Azure service optimization
  • Advanced authentication
  • Retry policies and timeout configuration
  • Enterprise-grade reliability

RefitterCodeGenerator

Version: v1.6.0

Generates a single file C# REST API Client interface for Refit using Refitter.Core. Combines a Refit interface generated by Refitter with contracts generated using NSwag.CodeGeneration.CSharp.

Reactive Patterns:

  • Refit interface generation
  • Reactive programming support
  • Clean interface design
  • Comprehensive testing capabilities

Configuration File Support

Generate code using configuration files:

  • .nswag configuration files from NSwagStudio by including it in the project and using the Generate NSwag Studio output context menu
  • .refitter settings files from Refitter by including it in the project and using the Generate Refitter output context menu
  • kiota-lock.json configuration files from Microsoft Kiota by including it in the project and using the Generate Kiota output context menu

Auto-Generation Features

🔄 Automatic Code Regeneration

Custom tools automatically regenerate client code whenever your OpenAPI specification files change, keeping your code always in sync with your API.

  • Auto-updating of generated code file when changes are made to the OpenAPI specification JSON or YAML file
  • Custom namespace definition for the generated file
  • Multiple file generation support for OpenAPI Generator and Kiota (configurable in settings)
  • Context menu integration for quick access to generation options

Advanced Configuration

Settings and Customization

The extension provides extensive configuration options for each code generator, accessible through the Visual Studio Tools menu.

Customizable Settings

Environment Configuration

  • Java path configuration - Specify custom Java installation paths
  • NPM and Node.js paths - Configure custom Node.js environments
  • JAR file locations - Use existing Swagger Codegen CLI and OpenAPI Generator JAR files

Generator-Specific Options

  • AutoRest Customization - Support for all C# generator settings, custom authentication schemes, retry policies
  • NSwag Customization - Full access to NSwag package properties, custom serialization settings, advanced type mapping
  • OpenAPI Generator Options - Access to additional properties, template customization, multiple output formats

Cross-Platform Support

Visual Studio Code Integration

Visual Studio for Mac

Dependencies and Requirements

Automatic Dependency Management

The Visual Studio Extension automatically adds the required NuGet packages that the generated code depends on:

NSwag Dependencies

  • Newtonsoft.Json - JSON serialization

OpenAPI Generator Dependencies

  • RestSharp - HTTP client library
  • JsonSubTypes - Polymorphic JSON serialization
  • Polly - Resilience and fault-handling library
  • Newtonsoft.Json - JSON serialization

Microsoft Kiota Dependencies

  • Microsoft.Kiota.Abstractions
  • Microsoft.Kiota.Http.HttpClientLibrary
  • Microsoft.Kiota.Serialization.* packages
  • Microsoft.Kiota.Authentication.Azure
  • Azure.Identity

Refitter Dependencies

  • Refit - REST library for .NET

Swagger Codegen CLI Dependencies

  • RestSharp - HTTP client library
  • JsonSubTypes - Polymorphic JSON serialization

AutoRest Dependencies

  • Microsoft.Rest.ClientRuntime
  • Newtonsoft.Json - JSON serialization

Runtime Requirements

  • Java Runtime Environment - Required for Swagger Codegen CLI and OpenAPI Generator
  • NPM - Required for AutoRest and NSwag CLI installations
  • .NET 7.0 - Required for Microsoft Kiota

📦 On-Demand Installation

The Swagger Codegen CLI and OpenAPI Generator are distributed as JAR files and downloaded on demand. AutoRest is installed via NPM as a global tool, and Microsoft Kiota is installed as a .NET Tool - all automatically managed for you.

Analytics and Error Reporting

Analytics configuration

Analytics and error reporting configuration options

  • Anonymous usage tracking - Helps improve the tool through Exceptionless and Azure Application Insights
  • Error reporting - Automatic error collection to improve stability and user experience
  • Privacy-focused - Uses secure hash of username@host for anonymous identification
  • Configurable - Can be completely disabled through the settings panel

Custom Tool Examples