首页 > 解决方案 > 找不到 Prism.PrismApplication

问题描述

我刚刚使用 MVVMLight、PRISM 和 DryIoc 启动了我的第一个 WPF 应用程序。App.xaml 引用 prism:PrismApplication,如https://prismlibrary.com/docs/wpf/getting-started.html中所述,没有错误。

<prism:PrismApplication x:Class="DYC.MembershipAndDues.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:DYC.MembershipAndDues"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:prism="http://prismlibrary.com/"
    xmlns:vm="clr-namespace:DYC.MembershipAndDues.ViewModel"
    xmlns:d1p1="http://schemas.openxmlformats.org/markup-compatibility/2006"
    d1p1:Ignorable="d"
    DispatcherUnhandledException="Application_DispatcherUnhandledException">
  <Application.Resources>
    <ResourceDictionary>
      <vm:ViewModelLocator x:Key="Locator" d:IsDataSource="True" />
    </ResourceDictionary>
  </Application.Resources>
</prism:PrismApplication>

在 App.xaml.cs 中,找不到 Prism.PrismApplication。我在对象资源管理器中找到了适用于 App.xaml.cs 的 PrismApplicationBase,但在 App.xaml 中,找不到 prism:PrismApplicationBase。xmlns:prism="http://prismlibrary.com/" 处的 xaml 声明与我已加载的包之间似乎存在脱节。

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="CommonServiceLocator" version="2.0.5" targetFramework="net472" />
  <package id="DryIoc.dll" version="4.0.7" targetFramework="net472" />
  <package id="MvvmLight" version="5.4.1.1" targetFramework="net472" />
  <package id="MvvmLightLibs" version="5.4.1.1" targetFramework="net472" />
  <package id="Prism.Core" version="7.2.0.1422" targetFramework="net472" />
  <package id="Prism.DryIoc" version="7.2.0.1422" targetFramework="net472" />
  <package id="Prism.Wpf" version="7.2.0.1422" targetFramework="net472" />
  <package id="System.ValueTuple" version="4.5.0" targetFramework="net472" />
</packages>

我错过了什么?

标签: prism

解决方案


找到了!它包含在依赖注入器容器中,即 Prism.DryIoc 或 Prism.Unity,具体取决于您使用的容器。


推荐阅读