在使用prism4时,在Silverlight 5中无法加载文件或程序集'System.Windows.Controls'。

4
我正在使用Prism 4创建一个Silverlight 5应用程序,当我使用UnityBootstrapper运行启动程序时,出现以下错误:
无法加载文件或程序集“System.Windows.Controls,Version=2.0.5.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35”或其某个依赖项。系统找不到指定的文件。
此错误出现在ConfigureRegionAdapterMappings方法中:
    protected override RegionAdapterMappings ConfigureRegionAdapterMappings()
    {
        // Call base method
        var mappings = base.ConfigureRegionAdapterMappings(); <-- I get the error here!
        if (mappings == null) return null;

        // Add custom mappings

        // Set return value
        return mappings;
    }

奇怪的是,如果我将项目更改为Silverlight 4,则它可以正常工作。你能帮我吗?
谢谢!

本月(2012年1月)将发布Prism 4.1,其中包括一些错误修复和对Silverlight 5的支持。 - Jehof
1个回答

6

这是因为Prism 4库针对Silverlight 4进行开发。您需要下载Prism的源代码,并将所有的Silverlight项目引用更改为Silverlight5,然后重新编译并设置新二进制文件的引用。


从NuGet获取Prism也是可能的,但(至少截至2012年7月)您需要删除自动添加的Prism引用(因为它引用SL4),然后再次添加引用,但使用在<YourProjectPath>\packages\Prism.4.1.0.0\lib\SL5中的程序集。 - SalvadorGomez

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接