Click here to Skip to main content
15,881,715 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,
this might be a simple one but I'll giev it a try ;)

Imagine the following dll strcture:

dll1
dll2
dll3

dll1 references dll2

dll3 references dll1

when I compile dll3 the compiler always want's me to also reference dll2.

Isn't that somehow passed with the references in dll1 (it references dll2 already)

Can this be avoided or is there a reason for this behavior?

best regards
Andy
Posted

1 solution

Unless DLL3 uses a type from DLL2 directly, there is no need to reference DLL2 from DLL3. What is the exact error message the compiler gives you?

[Updated]
------------
Okay, this is in response to your comment. What's happening is that DLL1 exposes a public method or property that uses an interface defined in DLL2. Now since DLL3 has a reference to DLL1, even if it does not use this method/property/interface, it still needs to be able to resolve all public members in all types defined in DLL1. Thus DLL3 will need a reference to DLL2.
 
Share this answer
 
v3
Comments
hoernchenmeister 21-Jan-11 9:23am    
The error is the following (sorry, I translated it...)
The type "library.Contracts.Core.Application.IEnvironmentProvider" is defined in a not referenced assembly. Add a reference to assembly "library.Contracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"

Its all about an interface there...
Nish Nishant 21-Jan-11 9:29am    
Ok, that makes sense now. I have updated my asnwer.
hoernchenmeister 21-Jan-11 9:33am    
Thanks a lot for explaining this to me, it makes perfectly sense!
Have a great day and thanks again,
best regards
Andy
Nish Nishant 21-Jan-11 9:35am    
You're welcome. You have a great day too.
Nish Nishant 21-Jan-11 13:17pm    
Thank you, Kryukov!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900