Which rules does VS (msbuild?) follow during solution build? In which cases it will copy indirectly referenced asemblies to output folder and in which not?
There is a subtlety not addressed by previous answers, namely whether the referenced assembly is in the GAC.
Consider a project that references assembly A, which in turn depends on assemblies B and C. Assembly C happens to have been installed into the GAC by some "other product". I have found that Visual Studio 2013 copies A and B, but not C, to the output folder, because C is already in the GAC. If I then run the application on a machine that doesn't have "other product" installed, I get a runtime binding failure.
I've also noticed that Microsoft's documentation in this area appears to be wrong, at least for VS2013.
Managing Project References states
If you deploy an application that contains a reference to a custom component that is registered in the GAC, the component will not be deployed with the application, regardless of the CopyLocal setting. In earlier versions of Visual Studio, you could set the CopyLocal property on a reference to ensure that the assembly was deployed. Now, you must manually add the assembly to the \Bin folder
My tests with VS2013 show that, contrary to the above, CopyLocal=True always copies the directly-referenced assembly to the output folder, regardless of whether it's in the GAC. But indirectly-referenced assemblies appear to be copied only if they are not in the GAC.
This behaviour means that to be sure that indirectly-referenced assemblies are deployed with your application you should add explicit references to them, with CopyLocal=True (or manually copy them). Note that by default CopyLocal will be set to False if the assembly is in the GAC.