I'm developing a set of assemblies which contain classes that, using a dependency injection framework, are supposed to be instantiated only by an "InstanceProvider" class --basically that's my gateway to SimpleInjector's GetInstance(). Then I'm packaging these assemblies as a nuget package.
My goal is to enforce that a developer does
var myDuck = InstanceProvider.GetInstance<IDuck>();
and doesn't do
var myDuck = new Duck();
For this, I have to avoid referencing some of the assemblies, the ones that contain the concrete implementations. I still need them to be there though.
So for now, I have them as dependencies in my nuget package. I'm looking for a way to keep them there, but when a developer uses the package for her project, some of the assemblies should not be directly referenced in their visual studio project.
Is this even possible?