I have assembly A with class Z that inherits from class X in assembly B. Now in a completely different solution, I have assembly C, which uses class Z.

The compiler complains unless assembly C has a reference to both assembly A & B. Even though assembly C does not use class Z directly in anyway.

Is this expected?

It seems to me that if assembly B is missing at run time stuff blows up, but at compile time it shouldn't care.

What am I missing here?

My goal is that I can tell my clients to depend on class Z in assembly A, but I can completely reconfigure my assemblies on the other side and have no effect at all on the client when they upgrade.


 
Friday, November 07, 2008 7:22:00 AM (Pacific Standard Time, UTC-08:00)
The definition of the type Z in A is incomplete: it says "I'm X, B but with the following changes." For the compiler to know what members Z has it needs to look at the definition of X too.

I agree this is kind of lame - lame that you have to add references to a whole chain of assemblies to be able to compile - but it's better than having multiple copies of the definition of X. B should be the one and only place where X is defined.
Name
E-mail
Home page

Comment (Some html is allowed: a@href@title, b, i, strike, u) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Enter the code shown (prevents robots):

Live Comment Preview