Not sure if this can be done, but here goes anyways.
I've written an N-tier application that's going to be implemeneted by end users. I wanted to expose 1 class only in a Project I called Myapp.client. Now, I want end users to ONLY have to include this DLL in their projects when working with the application. The problem I face though is that the Client Project (dll) obvioiusly has references to other projects in my solution. When testing by only including the client dll, I always get this type of compile error (which is normal and I understand it):
Error 1 The type 'XXXX.DataObjects.Someclass' is defined in an assembly that is not referenced. You must add a reference to assembly 'XXXX.DataObjects, Version=1.0.0.0, Culture=neutral, PublicKeyToken=8eefc54a8e08e7cc'.
Is there any way to automatically include these references when someone includes the client dll? Or would I have to rewrite the app to include everything in the client dll?
Thanks.
This sounds like a plugin architecture to me. The dll, what the plugin implementor should implement should ideally contain a clean interface. Of course that interface may contain some types what belongs to your code too. You have to refactor our architecture in a way that those types would be interfaces too, and ideally would be in one or few assemblies. Then you only have to provide the plugin-in interface assembly and the other slim interface assembly(s) to the client.
BTW, have you looked into MEF? Some years ago it was a CodePlex project but for a while now it's part of the .NET base now. It provides convenient way to decouple such architecture.
link
You just have to use [Export(...)]
and [Import(...)]
attributes and configure it's discovery. MEF also can serve as an IoC/Dependency Injection framework.