I receive the exception, if i do the following steps:
Test 1:
MainApp-Project:
Module-Project:
Autofac.WCF has the dependencies Autofac >=3.3.1 && < 5.0.0
Exception in Bootstrapper.cs: An unhandled exception of type 'System.IO.FileLoadException' occurred in Prism.Wpf.dll
Additional information: Die Datei oder Assembly "Autofac, Version=3.3.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da" oder eine Abhängigkeit davon wurde nicht gefunden. Eine bestimmte Datei konnte nicht gefunden oder geladen werden. (Ausnahme von HRESULT: 0x80131621)
Test 2:
I tried these steps too:
MainApp:
Module:
Could be possible, that I do a mistake, because i use Autofac and Autofac.WCF for the first time. I used before unity IoC.
Bootstrapper.cs:
using Autofac;
using Prism.Autofac;
using PrismAutofacApp2.Views;
using System.Windows;
using Prism.Modularity;
namespace PrismAutofacApp2
{
class Bootstrapper : AutofacBootstrapper
{
protected override DependencyObject CreateShell()
{
return Container.Resolve<MainWindow>();
}
protected override void InitializeShell()
{
Application.Current.MainWindow.Show();
}
protected override IModuleCatalog CreateModuleCatalog()
{
var modulecatalog = new DirectoryModuleCatalog() { ModulePath = @".\Modules" };
return modulecatalog;
}
}
}
Module:
using Prism.Modularity;
using Prism.Regions;
using System;
using Autofac;
namespace PrismModule2
{
public class PrismModule2Module : Module
{
IRegionManager _regionManager;
public PrismModule2Module(IRegionManager regionManager)
{
_regionManager = regionManager;
}
}
}
Update
I uninstalled as requested in comment the packages and then I reinstalled everything with the mentioned steps under Test 2., the problem still keeps.
If I deactived the module load by remove the overide method CreateModulecatalog, then the problem doesnt occures not anymore, means Autofac 4.5.0 + Autofac.WCF 4.0.0 in the MainApp works, but not if i load the module (incl. Autofac 4.5.0 and Autofac.WCF) with the CreateModulecatalog Autofac 4.5.0 and Autofac.WCF.
Please keep in mind the Module has no app.config, because is a module (dll) project.
Is very importend for me to get a project to run with the following requirements:
MainApp:
Modules:
Everything is blocked for me, because is not possible to load the module with autofac + autofac.wcf without exception in the mainapp (bootstrapper).
If somebody can support me, then I'm able to setup a teamviewer session with shared desktop to solve my issue and to give me guidance.
I solved with these steps:
My Module:
I did what Shazter recommended. I went to the GitHub link and downloaded the source. Once loaded up I removed the default Autofac that gets restored by NuGet. I then added the latest Autofac through NuGet and rebuilt a release version. I then referenced my new dll and no more problem.
User contributions licensed under CC BY-SA 3.0