I got the following issue:
I have a project / namespace ViewModels that containing several viewmodel classes described by a custom attribute that holds an interface type like:
[Register(typeof(IMyViewModel))]
public class MyViewModel : IMyViewModel
In another project I use Reflection to get all ViewModel-Types with this specific attribute and register them to an Autofac Inversion of Control - Container like
builder.RegisterType(type).As(interfaceType);
So far, it works correctly and the classes are registered as their interface types.
But now, if i call the Container.Resolve function of Autofac, there is an IO-Error saying some dlls have not been found. It looks like:
System.IO.FileNotFoundException: Could not load file or assembly '/storage/emulated/0/Android/data/MyProject/files/.__override__/de-CH/Autofac.resources.dll'
The issue seems to be because none of the types declared in the ViewModel project are instantiated anywhere directly. My program works like a charm if I create an empty class in the ViewModel project and simply instantiate it anywhere like
Class1 c1 = new Class1()
So my question is:
Is there a better way to make sure an assembly exists even if there is no direct instantiation of any type in it?
thank you very much :)
Aucun commentaire:
Enregistrer un commentaire