Reputation: 2855
I'm wondering what the best practice is for keeping track of all the dependencies for an application when one is using IoC/DI?
At the moment what I'm doing is copying the dependencies in a post-build step.
When a library is referenced "old-style" VS takes care of all of the copying to the bin folder so that all of the dependencies are there ready to be used but there's no such process (it seems) for the DI approach where the dependencies are determined at runtime.
Debugging then becomes (unless I'm doing something drastically wrong) a game of hunt-the-dependency and making sure you have all your files available. Look at the example below where I've already gone through Controller -> Interface -> Concrete Implementation -> DAL base class -> DAL and it breaks when looking for a dependency in the DAL code.
At this point I know it's going to hit the GAC so all should be well but lining up all the dependencies is tedious. If it's germane to the question the framework I'm using here is Unity.
Upvotes: 1
Views: 85
Reputation: 34275
You can set output of all projects to the same folder. Also less garbage in the file system this way. However, it may not be the best option in some cases (file name conflicts, building multiple separate products etc.).
Upvotes: 1