How can I create API client library in .NET Core project

Viewed 27

We have created a new API project using .NET Core 6 and create some API controllers. For that, how can we create an API client library for this project to consume the API?

1 Answers

If I am Not wrong, You meant to create a API client Library, which we can consume at an Web API project!

For this, At first Create a class Library project with the required implementation of API client. Refer - Creating a .Net Library project

Integration onto Web API Project-

local setup - Build the class library and once done, in the Web API -> Add project dependencies / references of the class library or add .dll file(You can find this in bin folder).

Resolve dependencies of class Library in Web project if any and consume the api client.

Advanced - cloud setup - publish it to artifactory and you can consume it via nugget package

Related