visual-studio-2010msbuildexternal-assemblies

How can the Visual Studio build output location be specified for referenced assemblies?


I have a solution that includes a mix of .NET 3.5 and 4.0 projects. The 3.5 projects cannot be upgraded due to external dependencies.

The solution uses a simple plugin mechanism and I've set the output path on all projects to a common bin folder in the solution folder so that plugin assemblies can be discovered and loaded when debugging.

I have .NET 3.5 projects referencing a 3rd party assembly and .NET 4.0 projects referencing the 4.0 version of the same assembly, which has the same file name as the 3.5 version. When I build, one version of the 3rd party assembly overwrites the other version.

I'd like to have these dependencies output to different subfolders so I can then set the probing private path in config but I can't see how to do this in the build process.


Solution

  • In all projects which overwrites referenced assembly, use CopyLocal: None property option for that reference in all projects using that assembly being referenced to, and using build events, copy that assembly to the output folder from it's original path in your primary build solution, to the places you required for the plugins. That will copy the required dll for the plugins only once after the primary builds up.