I've a WPF application that loads 3 different assembly which containts application extensions. I've added to the 3 projects the ModuleInit.Fody and for now just put a Console.WriteLine("module")
I load the assemblies with this piece of code
var files = Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory, "MyApplication.Modules*.dll");
List<Assembly> assemblies = new List<Assembly>();
foreach (var file in files)
{
AssemblyName assamblyName = AssemblyName.GetAssemblyName(file);
var assembly = Assembly.Load(assamblyName); //this throw an exception
// AssemblyName name = new AssemblyName()
//var assembly = Assembly.LoadFrom(file);
assembly.GetTypes().First();
assemblies.Add(assembly);
}
What am I doing wrong? Thanks
A module initializer is run the first time any type from that assembly is used. NOT when the module is loaded