WPF应用程序中的XamlParseException-但仅在安装在XP上时启用

WPF应用程序中的XamlParseException-但仅在安装在XP上时启用,wpf,xaml,windows-xp,xamlparseexception,Wpf,Xaml,Windows Xp,Xamlparseexception,我的WPF应用程序在Windows 7上运行良好。在XP计算机上安装会在启动时出现以下错误: 框架版本:v4.0.30319 描述:该过程已完成 由于未处理的错误而终止 例外 例外信息: System.Windows.Markup.XamlParseException 堆栈:在 System.Windows.Markup.XamlReader.RewrapException(System.Exception, System.Xaml.ixamlineinfo,System.Uri) 在 Syst

我的WPF应用程序在Windows 7上运行良好。在XP计算机上安装会在启动时出现以下错误:

框架版本:v4.0.30319

描述:该过程已完成 由于未处理的错误而终止 例外

例外信息: System.Windows.Markup.XamlParseException

堆栈:在 System.Windows.Markup.XamlReader.RewrapException(System.Exception, System.Xaml.ixamlineinfo,System.Uri)

在 System.Windows.Markup.wpfxamloader.Load(System.Xaml.XamlReader, System.Xaml.IXamlObjectWriterFactory, 布尔型,系统对象, System.Xaml.XamlObjectWriterSettings, System.Uri)

在 System.Windows.Markup.wpfxamloader.LoadBaml(System.Xaml.XamlReader, 布尔型,系统对象, System.Xaml.Permissions.XamlAccessLevel, System.Uri)

在 System.Windows.Markup.XamlReader.LoadBaml(System.IO.Stream, System.Windows.Markup.ParserContext, System.Object(布尔型)

在 System.Windows.Application.LoadComponent(System.Object, System.Uri)

在 MyApplication.App.InitializeComponent()

在MyApplication.App.Main()中

我想我可能遇到了这个问题的答案中描述的问题:

因为我正在使用PresentationFramework.Aero。有没有办法解决这个问题,或者我必须删除Aero?这是一个痛苦,因为我正在使用一些扣眼


TIA

我在Windows XP SP3上也遇到了同样的问题,对我来说,通过设置PresentationFramework的“Copy Local”属性解决了这个问题。Aero引用“True”

参考Aero的ResourceDictionary时,请尝试指定完整的程序集名称,而不是短的程序集名称

<ResourceDictionary Source="/PresentationFramework.Aero, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35,ProcessorArchitecture=MSIL;component/themes/aero.normalcolor.xaml" />

  • 确保在任何UI的构造函数中都没有引发异常 组件(例如.cs文件的代码隐藏)
  • 如果使用的是MVVM,请确保没有在ViewModel构造函数中引发任何异常

我有一个视图模型抛出了一个与Xaml完全无关的异常(与COM组件有关[我现在要跟踪它!])。如果基于Xaml的组件创建失败,您将得到一个
XamlParseException
,这可能会产生误导。

修复:当您在具有自定义英语(美国)区域设置的计算机上运行WPF应用程序时,会引发Xaml解析器中的异常


我遇到了完全相同的问题,您是否找到了一个可以发布问题答案的解决方案?原始链接已损坏,请在此处阅读: