I need to configure the CORS of multiple Apis with the same setting. So, I decided to create a class library and wrap the IServiceCollection.AddCors in a new extension method push it to my package repository (Nexus), and use the DLL for all of my APIs.
However, I could not find the package that the AddCors function belongs to.
I Added
- Microsoft.Extensions.DependencyInjection
- Microsoft.Extensions.DependencyInjection.Abstractions
But I there is this error:
CorsInjection.cs(9, 33): [CS1061] 'IServiceCollection' does not contain a definition for 'AddCors' and no accessible extension method 'AddCors' accepting a first argument of type 'IServiceCollection' could be found (are you missing a using directive or an assembly reference?)
How can I figure it out in dotnet core 8 class library?