Project Setup

The C# code generated by C# can be included in multiple Visual Studio project types:

Add Generated Files to the Project

After generating code into an existing project directory, open the Solution Explorer tab in Visual Studio and click the “Show All Files” button to make the files that are not part of the project visible. Show All Files

Right-click on the Generated folder and select Include In Project from the context menu. Include In Project

Add the ClientRuntime NuGet Package

AutoRest generates code that depends on the Microsoft.Rest.ClientRuntime NuGet package. This package includes a dependency on Newtonsoft.Json.Net. Depending on your project profile, NuGet may pull down several additional packages dependencies.

Use the Package Manager UI to add Microsoft.Rest.ClientRuntime. NuGet package manager

Or install using the Package Manager Console.

PM>Install-Package Microsoft.Rest.ClientRuntime

Use the Client:

var client = new SwaggerPetstore();
Pet myPet = client.FindPetById(10);