c# - Hierarchical dependency and "The type is defined in an assembly that is not referenced" -
for example, have 3 class libraries: l1, l2 , l3. l1 has type t1. l2 has type t2. l2 has reference l1. l3 has reference l2. l3 has no explicit reference l1.
it compiles , works absolutely okay if t2 class looks like:
public class t2 { t1 gett1() { ... }; } but if t2 uses t1 parameter in constructor, says t1 defined in assembly not referenced. when build l3:
public class t2 { t2(t1 t1) { ... }; t1 gett1() { ... }; } is possible somehow ignore error? not use constructor t1 in l3 , not want add reference l1.
when expose type in constructor mandates reference type library. classic example of when use either interface or abstract class.
Comments
Post a Comment