I have the source code that I received from an external developer, this code is divided into 4 types of projects: their structure, the environment for my project (allows you to call it "ENV"), the application database (call it "Base" ") and the application itself (about 20 dlls libraries, which I will call "App").
Now I have added another layer to this mess, a dll called AdvanceFeatures. It lies directly below the ENV (over the frame). This dll refers only to the structure, and ENV refers to it. Only ENV uses this AdvanceFeatures dll, while Base and App use only ENV.
As I work here, most of the objects in the application are defined in Base and inherit / implement classes / interfaces in ENV. Also, a small part of these objects (in the application and the database) inherits / implements classes / interfaces from the structure itself (but this is quite rare).
So far, all is well, except for one fact. Compiler requirement I will add a link to the AdvanceFeatures dll from each of the DLLs in the application and from the database.
I do not use AdvanceFeatures outside of ENV, so why do I need these links?
Edit: I created a demo project for this problem. These are the project details:
Assembly: AdvanceFeatures References: Nothing (Reference project-folder is empty) Classes: Decorator, IEnvClass, IDecorator IDecorator contents: namespace AdvanceFeatures { public interface IDecorator { IEnvClass Decorated { get; } void Decorate(); } } IEnvClass contents: namespace AdvanceFeatures { public interface IEnvClass { string Name { get; set; } } } Decorator contents: namespace AdvanceFeatures { public class Decorator : IDecorator { public Decorator(IEnvClass decorated) { Decorated = decorated; } #region Implementation of IDecorator public IEnvClass Decorated { get; set; } public void Decorate() { Decorated.Name = "NewName"; } #endregion } } Assembly: ENV References: AdvanceFeatures (Compiled DLL) Contents of only class SomeEnvClass: namespace ENV { public class SomeEnvClass : AdvanceFeatures.IEnvClass { public string Name { get; set; } private readonly AdvanceFeatures.IDecorator _decorator; public SomeEnvClass(string name) { Name = name; _decorator = new AdvanceFeatures.Decorator(this); _decorator.Decorate(); } public string Foo() { return Name; } } } Assembly: TestBase References: ENV (compiled DLL) Contents of only class SomeEnvExtendingClass: namespace TestBase { public class SomeEnvExtandingClass : ENV.SomeEnvClass { public SomeEnvExtandingClass(string name) : base(name) { } } }
I get an error message:
Error 1 The type "AdvanceFeatures.IEnvClass" is defined in an assembly that is not referenced. You must add a reference to the assembly "AdvanceFeatures, Version = 1.0.0.0, Culture = neutral, PublicKeyToken = null". E: \ Projects \ Dev \ TestReferenceInheritance \ TestBase \ SomeEnvExtandingClass.cs 3 18 TestBase
Now I know why the DLL should be available for the compiled executable, but why should the developer know the internal work of ENV (more precisely, this inheritance tree) in order to expand it?