1

Say I make 3 assemblies A, B and C, with B referencing C and A referencing B. Building A I'll find A.dll and B.dll in my bin\debug, but no C.dll. Both references have "copy local=true".

I don't understand why it behaves this way, as surely you would expect things not to work if you do this.

Can someone please explain why things are this way, and does anyone know of a way to build everything that needs to be built given that I've already "told" (through my references) the system that A needs B which needs C?

us2012
  • 16,083
  • 3
  • 46
  • 62
The Dag
  • 1,811
  • 16
  • 22
  • Would the reference from B to C be a sole `typeof` statement in an attribute? In this case, B needs C at compile time, but not at execution time, because the `Type` object would have been serialized. – Laurent LA RIZZA Oct 14 '13 at 12:51
  • Note that A, B and C are all class libraries. I've tried to see what happens if I add an assembly with an entry point (a WinForms), App referencing A. This gave *strange* results: If A doesn't contain code that is compile-time dependent on B, only App.exe is generated. If A contains code that uses B that uses C, App and the 3 libraries are generated - regardless of whether App uses anything in A! – The Dag Oct 14 '13 at 12:59
  • @LaurentLARIZZA No, it's rather the opposite! Many assemblies depend on a common assembly. This assembly references an EntLib assembly with a trace listener implementation. There's dependency injection via the EntLib configuration (what type of trace listener to use), but our common assembly references the relevant entlib library. It just doesn't get deployed. Adding a reference to the relevant entlib library (Microsoft.Practices.EnterpriseLibrary.Database.Logging) from each project that uses common solves the issue, but I don't understand why we should have to... – The Dag Oct 14 '13 at 13:02
  • I've experienced that actually, when VS deploys the assemblies, for a particular project, it deploys the project artefact with the direct dependencies you requested. But when it comes to indirect dependencies, it seems that VS trusts the import directives in the PE headers of the DLLs ans EXEs. – Laurent LA RIZZA Oct 14 '13 at 13:52

0 Answers0