I have an assembly A that defines an interface with some overloads:
public interface ITransform
{
Point InverseTransform(Point point);
Rect InverseTransform(Rect value);
System.Drawing.Point InverseTransform(System.Drawing.Point point);
}
...and an assembly B that references A (the binary, not the project) and calls one of the overloads:
var transform =
(other.Source.TransformToDisplay != null &&
other.Source.TransformToDisplay.Valid) ?
other.Source.TransformToDisplay : null;
if (transform != null)
{
e.Location = transform.InverseTransform(e.Location);
}
To be precise, it calls the System.Windows.Point
overload of the InverseTransform
method, because that is the type of the property Location
in e
.
But when I build B in the IDE I get:
error CS0012: The type 'System.Drawing.Point' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
even though that's not even the overload I am calling. When I comment out the line where the overloaded method InverseTransform
is called, it builds fine even though I'm still instantiating an object of type ITransform
.
Why? And is there a way to fix this without having to add a reference to System.Drawing
everywhere?