1
找到名称为{0}的重复模块我正在尝试使用Prism,MEF和WPF创建一个非常基本的应用程序。我有一个WPF应用程序项目,它有一个Shell.xaml和引导程序。规范引导程序如下:问题与MEF和棱镜:装载机
public class SimpleMefApplicationBootstrapper : MefBootstrapper
{
protected override void ConfigureAggregateCatalog()
{
//base.ConfigureAggregateCatalog();
this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(SimpleMefApplicationBootstrapper).Assembly));
this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(PrismApp.Module.Hello.HelloModule).Assembly));
this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(PrismApp.Module.Hello.FinishModule).Assembly));
}
protected override DependencyObject CreateShell()
{
return this.Container.GetExportedValue<Shell>();
}
protected override void InitializeShell()
{
//base.InitializeShell();
Application.Current.MainWindow = (Window)this.Shell;
}
protected override IRegionBehaviorFactory ConfigureDefaultRegionBehaviors()
{
var factory = base.ConfigureDefaultRegionBehaviors();
return factory;
}
在上述方案中,我有其中有一个文件夹视图,视图模型文件夹和两个模块的另一个类库。这两个模块绑定到两个视图,以便它们可以用作区域。如果我尝试从botstrapper只调用一个模块,但不是在调用这两个模块时,它完美地工作。它给了我错误的详细信息,如:
加载程序找到名为FinishModule的重复模块。
我不明白如果两个模块都有不同,那么问题是什么。我试着改变组装也为两个模块,但没有运气。
任何想法?
我是不认为,但如果两个模块与不同的名字都在同一总成那么我们应该调用只有一个太傻?是吗?因为它在任何情况下都有效。 – user728630
它是你需要的组件,所以取决于你的模块最终驻留在哪里 – davidcarr