无法加载文件或程序集“Windows,版本=255.255.255.255,Culture=neutral,PublicKeyToken=null,ContentType=WindowsRuntime" [英] Could not load file or assembly 'Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime'

查看:51
本文介绍了无法加载文件或程序集“Windows,版本=255.255.255.255,Culture=neutral,PublicKeyToken=null,ContentType=WindowsRuntime"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

安装 vs2012 并更新我的 vs2010 WPF 项目后,我在 WPF 设计器中收到以下错误:无法加载文件或程序集Windows,版本=255.255.255.255,Culture=neutral,PublicKeyToken=null,ContentType=WindowsRuntime"或其依赖项之一.不支持操作.(来自 HRESULT 的异常:0x80131515)

After installing vs2012 and updating my vs2010 WPF project I get the following error in WPF designer: Could not load file or assembly 'Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)

对于项目中的每个 xaml 页面都会发生这种情况.

This happens for every xaml page in the project.

<dx:DXWindow.DataContext>
    <vm:MyViewModel/>
</dx:DXWindow.DataContext>

VS 将 vm:MyViewModel 标记为问题行.如果我将其注释掉,设计器窗口会显示一个空白页面.同样的项目在 VS2010 中运行良好.两个版本的visual studio都将目标框架设置为4.

VS marks vm:MyViewModel as the problem line. If I comment it out the designer windows shows a blank page. This same projects works fine in VS2010. The target framework is set to 4 in both versions of visual studio.

推荐答案

当与 Visual Studio 2012 或在引用 winmd 程序集的项目中使用时,这是实体框架 (EF5) 中的错误.

This is a bug in Entity Framework (EF5) when used with Visual Studio 2012 or in a project that references a winmd assembly.

EF 尝试加载所有引用的程序集以检查它们是否包含预编译视图.在此过程中,EF5 在尝试加载 winmd 程序集时失败.尝试使用 Assembly.Load 加载 winmd 程序集会导致 System.IO.FileLoadException 在 EF5 中未处理.

EF tries to load all referenced assemblies to check if they contain pre-compiled views. During this process EF5 fails when it tries to load a winmd assembly. Trying to load winmd assemblies with Assembly.Load causes a System.IO.FileLoadException which is not handled in EF5.

注意:虽然您的应用程序可能没有对任何 .winmd 程序集的引用,但 VS2012 WPF 设计器的宿主进程 (xdesproc.exe) 有对 Windows.winmd 程序集的引用.这解释了为什么这些项目在 VS2010 和运行时运行良好.您可以使用 .NET Reflector 来确认这一点.

NOTE: Although your application might not have a reference to any .winmd assembly, VS2012 WPF Designer's host process (xdesproc.exe) has a reference to the Windows.winmd assembly. This explains why the projects work fine in VS2010 and during runtime. You can use .NET Reflector to confirm this.

此问题已在 EF6 中修复.

This issue has been fixed in EF6.

为此http://entityframework.codeplex.com/workitem/609

并在变更集 50c1e5a2c46d 中修复 http://entityframework.codeplex.com/SourceControl/changeset/50c1e5a2c46d

and fixed in changeset 50c1e5a2c46d http://entityframework.codeplex.com/SourceControl/changeset/50c1e5a2c46d

这篇关于无法加载文件或程序集“Windows,版本=255.255.255.255,Culture=neutral,PublicKeyToken=null,ContentType=WindowsRuntime"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆