WPF Prism:创建Shell时出现问题

WPF Prism:创建Shell时出现问题,wpf,prism,mef,Wpf,Prism,Mef,我刚开始学习Prism,并尝试在测试WPF应用程序中与MEF一起使用它。 基于“WPF动手实验室:开始使用棱镜” 在Prism4文档中的“库”示例中,在一个测试WPF项目中,我将MainWindow类重命名为Shell 我的Bootstrapper类具有以下代码(也基于实验室示例): App.xaml.cs代码: public partial class App : Application { protected override void OnStartup(StartupEventA

我刚开始学习Prism,并尝试在测试WPF应用程序中与MEF一起使用它。
基于“WPF动手实验室:开始使用棱镜” 在Prism4文档中的“库”示例中,在一个测试WPF项目中,我将MainWindow类重命名为Shell
我的Bootstrapper类具有以下代码(也基于实验室示例):

App.xaml.cs代码:

public partial class App : Application
{
    protected override void OnStartup(StartupEventArgs e)
    {
        base.OnStartup(e);
        Bootstrapper bootstrapper = new Bootstrapper();
        bootstrapper.Run();
    }
}
当我尝试运行应用程序时,即使没有导出其中的任何模块,也会出现错误:
“找不到资源‘mainwindow.xaml’。”


我做错了什么?

当您重命名类时,mainwindow.xaml是否被重命名为shell.xaml


但是代码/配置仍然指向原始名称

是的,我的mainwindow.xaml被重命名为shell.xaml。你是说App.xaml字符串StartupUri=“MainWindow.xaml”吗?是的,删除后错误消失了。谢谢大家!+1有同样的问题,我目前正在设置PRISM WPF企业级应用程序!通过所有其他人可能遇到的障碍!太糟糕了,我无法将你的评论标记为回答感谢@Shiraz Bhaiji,我发现我的App.xaml仍然具有属性
StartupUri=“MainWindow.xaml”
它应该被删除。上面提到的Prism4文档中指出了这一点:“打开App.xaml文件并删除属性StartupUri。因为您正在引导程序中手动实例化shell窗口,所以不需要该属性。”我只是错过了这一点。
public partial class App : Application
{
    protected override void OnStartup(StartupEventArgs e)
    {
        base.OnStartup(e);
        Bootstrapper bootstrapper = new Bootstrapper();
        bootstrapper.Run();
    }
}