Could not load file or assembly 'Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime'

1

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)

This happens for every xaml page in the project.

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

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.

wpf
visual-studio-2010
xaml
visual-studio-2012
asked on Stack Overflow Jan 14, 2013 by Nik

1 Answer

7

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

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.

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.

This issue has been fixed in EF6.

A bug was filed for this http://entityframework.codeplex.com/workitem/609

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

answered on Stack Overflow May 13, 2013 by Jamleck • edited May 13, 2013 by Jamleck

User contributions licensed under CC BY-SA 3.0