My Visual Studio solution has several late-bound projects (dll) which are loaded by other projects in runtime. The dll loaded depends on some runtime condition.
To load dll in runtime I need it to be present in the application bin directory, and there are several of those apps. To do that I run a post-build script which copies late-bound dll to every application that may need it. I’d like to get rid of the script because it creates a heavy xcopy post-build process which is not really necessary.
What do you use in this case?
I can also add a reference to dll from every application, however in this case I will create a type reference and I (or other developer) may accidentaly reference a type from late-bound dll which may not be present on client’s server.
I’ve dealt with this problem before as well, it’s quite frustrating. The approach I take now is to remove the directory dependency; externalize the location of these late-bound libraries (in the config file), then keep them in a shared location, which you set the build output of the libraries to.
When it comes to deployment, you change that setting, and package the libraries with your installer.
This is especially useful when developing/debugging several independent applications as you only need to keep track of a single copy of the libraries.
If that’s not an option for you – perhaps it’s too difficult to externalize or perhaps there are major variances in the dependencies from one app to the next – then I would go with nobugz’s answer.