Background
There are lots of Web APIs that are exposed in Real-world, few are open to consuming and few need a license to consume those Web APIs. All the Web APIs has a different specification to implement at client side. The implementation part at the client side is hectic and a lot of developer effort is required. To speed up the development task with zero lines of code and ready to use the Web API at the client application, here we have an interesting tool to generate the client code by using NSwagStudio or Open API – Swagger.
If you are new to Swagger integration with ASP.NET Core, I would encourage you to go through the article link - Integrating Swagger with Web API .Net Core using Entity Framework, there I have demonstrated to integrate a Swagger library into an ASP.NET Web API using Entity Framework.
Tools download References
- NSwagStudio
- Unchase OpenAPI – Swagger: Install through Visual Studio ‘Manage Extension’
Both the tools are similar with features, however ‘OpenAPI – Swagger’ can be integrated with Visual Studio and use as instantly in the new project to create a client code.
Approach 1
Once NSwagStudio is installed and the home screen looks as below,

Select the Runtime of the Application, Web API Specification file or URL, Type of client code, setting of client code.
Approach 2
Unchase OpenAPI – Swagger in ‘Manage Extension’. Install this extension and restart the Visual studio.

In this article, I am going to demonstrate Approach 2 - “Unchase OpenAPI – Swagger” extension and the generation of client code instantly. This extension is a connected service and Visual Studio it’s getting easier to connect your application to Azure services via Visual Studio Connected Services.
Client code generation by Unchase OpenAPI – Swagger
Step 1
Create a new Console app of the .Net Core project and give the name of the project. E.g., Project name as ‘CompanyWebApiClient’
Step 2
To access Visual Studio Connected Services, go to your projects, “Overview” which can be accessed by right-clicking on your project and select “Overview” OR Right-clicking on your project, "Add" Connected Services.
Step 3
Then select the “Connected Services” tab on the left to show the list of Connected Services available in your Visual Studio instance.

Step 4
Once the OpenAPI swagger extension is installed successfully, you should able to see the OpenAPI service in the “Connected Services” section.
Step 5
Click on “Unchase OpenAPI (swagger) Connect Service” and will pops-up a dialog as below,

Step 6
Set the following parameter with Service Name, Web API specification document, and type of client code generation as below.











Join the conversation! Your thoughts help the community grow.