WPF项目Win7运行出现未能加载文件或程序集 resentationFramework.Aero2解决方法

win10下开发的WPF项目在win7运行时出现了一个错误:

System.Windows.Markup.XamlParseException: 设置属性“System.Windows.FrameworkElement.Style”时引发了异常。 —> System.IO.FileNotFoundException: 未能加载文件或程序集“PresentationFramework.Aero2, PublicKeyToken=31bf3856ad364e35”或它的某一个依赖项。系统找不到指定的文件。

解决方法:

项目-引用-将PresentationFramework.Aero2替换为PresentationFramework.Aero即可

 

XAML编辑器错误 (Exception from HRESULT: 0x80270254) 解决方法

the same started to happen to me today; to reproduce the issue, I just open Visual Studio 2013 Update 4, create a blank Windows Phone 8.1 and double click on MainPage.xaml.

I solved by performing the following (a mix of what I’ve read around the web):

  • exit all Visual Studio instances
  • delete everything on %localappdata%\Microsoft\VisualStudio\12.0\Designer\ShadowCache
  • open a command prompt with admin rights and execute the following commands:
    pushd %VS110COMNTOOLS%
    icacls ..\IDE /grant *S-
    11521:(OI)(F)
    icacls ..\IDE /grant *S-
    11521:(CI)(F)
    icacls ..\IDE\PrivateAssemblies /grant *S-
    11521:(OI)(F)
    icacls ..\IDE\PrivateAssemblies /grant *S-
    11521:(CI)(F)
    icacls ..\IDE\PublicAssemblies /grant *S-
    11521:(OI)(F)
    icacls ..\IDE\PublicAssemblies /grant *S-
    11521:(CI)(F)

finally, reboot. worked on Windows 8.1 64-bit.

来自 <http://stackoverflow.com/questions/24593249/windows-phone-8-app-does-not-contain-a-definition-for-initializecomponent/24772492#24772492>