C
C#7mo ago
Esa

✅ class library and exposing a type from another namespace

Hi, in my company we have an underlying core application which runs things. This application has many modules (.dlls) which have apis we can call. So we usually reference those binaries in our solutions. However the way this is done currently is by downloading the binaries from an internal repository and referencing them in our solutions. I'd like to move this entire process to our private nuget, so that we never have to touch a binary manually again. So currently I've setup a release pipeline to that private nuget source. Consider the following modules:
CoreApp.Customers.dll
- ICustomersService.cs
CoreApp.Products.dll
- IProductsService.cs
CoreApp.Customers.dll
- ICustomersService.cs
CoreApp.Products.dll
- IProductsService.cs
I have created a class library solution that mirrors this somewhat:
Internal.CoreApp
Customers
Products
Internal.CoreApp
Customers
Products
So what I want to achieve is that a developer that needs ICustomersService in their solution can install my nuget package in their solution, and use my extension methods on IServiceCollection to add ICustomersService to the DI in their .net 7.0 project. And it works so far. However, when I'm testing this from a different project that has installed my nuget package, I don't have access to the type ICustomersService. I think that is because it doesn't come from the same namespace and is hidden behind my abstraction layer, so how can I expose this?
1 Reply
Esa
Esa7mo ago
I tried asking Bing Chat this same question, and it suggests creating my own ICustomersService interface that inherits from the one in the other namespace that is currently invisible 🤔