Is there a possibility to make the compiler not check functions and methods that aren't used? I'm working on an app that relies on code (in C#), in which members of the system.windows.forms.dll are used in some functions and methods. For instance:
protected IWin32Window parentWindow;
public virtual UserControl GetFirmwareInformation()
My app doesn't use this members, but it tries to load the dll anyway, and doesn't succeed, because, as I know, you can't use this dll. Now I'm looking for a workaround, because I can't throw the "forms-using methods" away. One solution would be, to use precompiler directives, but I hope, that there is a more elegant way, because in the solution is also another c# desktop-program that can use the forms-dll.
Is there another solution?
One thing you could do is to ship some files with your MonoDroid app which implement stubbed out versions of the missing interfaces, classes, enums and methods.
A neater solution might be to split those dependencies out of your source code somehow - either using some form of interface/injection or just simply using partial classes to split your code between multiple files. I'd personally go for some injection mechanism - but that's because I find using partial classes like that is quite similar to using #define
.