-1

Reading MSDN's documentation, I was left uncertain.

Setting: I have project A referencing some dll X, and project B project-referencing project A, and requiring dll X as well.

Would I need to add a reference to dll X to both projects, or would the project reference do that for me?

yuvalm2
  • 866
  • 2
  • 10
  • 27
  • if you want to use X dll types directly in project B then you will need to add reference there as well – Ehsan Sajjad May 23 '17 at 11:10
  • 1
    Depends on the kind of DLL. If it is normal .NET assembly and gets copied by the B project to B's output directory then, yes, it will automatically get copied as well. Do consider not asking for a manual but describing what you actually see happening, saves everybody a lot of time. – Hans Passant May 23 '17 at 11:12

1 Answers1

2

You only need to add a reference to X when classes, methods, etc. of X are made available through A.

If there is no public use of X in A, you don't need to reference it (although you would need it in your bin folder.

Patrick Hofman
  • 153,850
  • 22
  • 249
  • 325
  • What do you mean by made available and public use? Use in public classes and functions within A? – yuvalm2 May 23 '17 at 11:25
  • 1
    When it exposes the member through a method for example, so: `public void DoSomething(ClassFromX x)`. – Patrick Hofman May 23 '17 at 11:30
  • So it is something like a transitive closure. If I reference X, and X contains a property of type Y, which contains a property of type Z etc., I will get Y and Z as well. (And all types they contain recursively) – yuvalm2 Sep 26 '17 at 20:18