Reputation: 1387
Say I have two class libraries in C# and an outside project that I want to use those libraries in:
LibA.dll
LibB.dll which also references LibA.dll because it uses some of its classes.
Project C which references both LibA.dll and LibB.dll
Lets say inside of LibB.dll
I have a method that returns a class type from LibA.dll
and inside of my project, I want to immediately set the proper class types when calling that method. For example:
LibA.classInsideLibA myObj = LibB.getClassInsideLibAInstance();
This should work, but I am wondering if there will be any issues present when referencing LibA.dll
and LibB.dll
inside of my project when LibB.dll
already references LibA.dll
. Does referencing LibB.dll
automatically reference LibA.dll
in this case?
Upvotes: 0
Views: 123
Reputation: 4395
You already do this all the time. Take for instance the string
class and pretend that's your LibA
. I'm sure you've got a library that returns a string
. You've also probably returned a string from your library and referenced mscorlib
(where String
lives) in your main project.
This is no different.
System.String myString = LibB.GetSomeString();
Upvotes: 1
Reputation: 50210
". Does referencing LibB.dll automatically reference LibA.dll in this case"
I assume we are discussing refernces in VS projects . Of course all dlls have to be available at runtime
It depends. If you have projX->DLLA->DLLB
if DLLA uses DLLB but doesnt expose any of DLLB types (ie returns a DLLB class in one of its methods) then ProjA doesnt need to know about DLLB
If DLLA does return DLLB classes the projA needs a reference to DLLA and DLLB
Upvotes: 1