首页 > 其他分享 >win7下使用Aero2主题错误

win7下使用Aero2主题错误

时间:2024-03-15 17:23:15浏览次数:21  
标签:错误 Windows win7 System Boolean Baml2006 Aero2 RuntimeAssembly

开发了一个gui工具,有同事在win7环境下发现界面无法加载出来。
经过调试发现,在view初始化的过程中,提示PresentationFramework.Aero2无法加载,异常信息如下:

{System.BadImageFormatException: Could not load file or assembly 'PresentationFramework.Aero2, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Reference assemblies should not be loaded for execution.  They can only be loaded in the Reflection-only loader context. (Exception from HRESULT: 0x80131058)
File name: 'PresentationFramework.Aero2, PublicKeyToken=31bf3856ad364e35' ---> System.BadImageFormatException: Cannot load a reference assembly for execution.
   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   at System.Windows.Baml2006.Baml2006SchemaContext.ResolveAssembly(BamlAssembly bamlAssembly)
   at System.Windows.Baml2006.Baml2006SchemaContext.ResolveBamlTypeToType(BamlType bamlType)
   at System.Windows.Baml2006.Baml2006SchemaContext.ResolveBamlType(BamlType bamlType, Int16 typeId)
   at System.Windows.Baml2006.Baml2006SchemaContext.GetXamlType(Int16 typeId)
   at System.Windows.Baml2006.Baml2006Reader.Process_ElementStart()
   at System.Windows.Baml2006.Baml2006Reader.Process_OneBamlRecord()
   at System.Windows.Baml2006.Baml2006Reader.Process_BamlRecords()
   at System.Windows.Baml2006.Baml2006Reader.Read()
   at System.Windows.Markup.WpfXamlLoader.TransformNodes(XamlReader xamlReader, XamlObjectWriter xamlWriter, Boolean onlyLoadOneNode, Boolean skipJournaledProperties, Boolean shouldPassLineNumberInfo, IXamlLineInfo xamlLineInfo, IXamlLineInfoConsumer xamlLineInfoConsumer, XamlContextStack`1 stack, IStyleConnector styleConnector)
   at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)

查看自己的代码,确实在窗体中使用了主题库

xmlns:Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero2"

我开发时,使用的是win10环境,目标框架是nf4.8,所以这个库能正常引用。而客户机上,安装了nf4.8的运行时,但搜索之后,发现客户机上并没有这个库。
为了适配客户机环境,我选择讲开发环境的这个库放到bin目录下,就能正常引入创建了。
浏览相关信息的时候,看到还有种解决思路,就是放弃使用该主题,感觉也是个思路,可以按需选择。

参考:
https://www.cnblogs.com/dino623/p/Windows7-Using-Aero2.html
https://learn.microsoft.com/en-us/archive/msdn-technet-forums/cee2efbb-f9ef-43b2-8ff2-a03b3dafe1d9

标签:错误,Windows,win7,System,Boolean,Baml2006,Aero2,RuntimeAssembly
From: https://www.cnblogs.com/GISyunqi/p/18075867

相关文章

  • 猫头虎分享已解决Bug | 成功解决java.lang.OutOfMemoryError: Java heap space错误
    博主猫头虎的技术世界......
  • 运行tomcat9.0发生的错误Using CATALINA_OPTS: ““
    问题描述:软件环境:JDK:17\apache-tomcat-9.0.86问题描述在运行tomcat中发生闪退编辑startup.bat在结尾输入pause再次运行报如下错误添加环境变量再次运行成功运行......
  • C++ error C2143: 语法错误: 缺少“;”(在“*”的前面)
    errorC2143编译错误但是,我在官网的例子上没有找到我所遇见的问题!在此记录一下,问题代码如下:1classtestA1;2classworkclass3{4public:5explicitworkclass();6virtual~workclass();7private:8intM_INT;9......
  • CentOS7系统虚拟环境下pip install uwsgi遇到错误
    遇到的错误为ERROR:Couldnotbuildwheelsforuwsgi,whichisrequiredtoinstallpyproject.toml-basedprojects尝试了n种办法,按照网上的攻略甚至是ChatGPT的说法安装了一堆的环境依赖,都解决不了。最后看到有人在装其他组件遇到类似的问题,思路是要装的版本相对于所安装的......
  • Qt "QWidget: Must construct a Qapplication before a Qwidget"错误
    问题该错误信息表示在创建QWidget(窗口部件)之前必须先创建QApplication(应用程序)。这是因为QApplication在创建QWidget之前会进行一些初始化操作,确保正确运行应用程序。要解决这个错误,您需要在创建QWidget之前先创建QApplication。以下是处理该错误的常见方法:1.在......
  • 278. 第一个错误的版本c
    //TheAPIisBadVersionisdefinedforyou.//boolisBadVersion(intversion);intfirstBadVersion(intn){inthead=1,tail=n;if(isBadVersion(head))return1;while(head<=tail){intmid=head+(tail-head)/2;if(isBadVersion(......
  • 2024年HP笔记本安装Win7虚拟机的过程
    2024年HP笔记本安装Win7虚拟机的过程背景一个项目安装说明指定要求是Win7x64外加firefox+flash的组合。因为Win7已经EOL两年多了flash也EOL快四年了。所以没办法想通过WorkStation进行一下部署和创建。结构发现坑不少。所以记录一下。关于WorkStation的版本部分Wor......
  • Java 错误 java.net.ConnectException
    本篇文章介绍了Java中的java.net.ConnectException错误。Java中的java.net.ConnectException错误java.net.ConnectException是使用网络时最常见的异常。它主要发生在客户端、应用程序和服务器之间建立TCP连接时。它是一个经过检查的应用程序,可以使用try-cat......
  • GoFrame 优化接口的错误码和异常的思路
    前言你是否想在使用GoFrame的过程中,拥有一个能打印异常堆栈,能自定义响应状态码,能统一处理响应数据的接口。如果你回答是,那么,请耐心看完本文,或许会对你有所启发。若文中由表达不当之处,恳请不吝赐教。异常都需要错误堆栈吗为什么会问这个问题呢,所有的接口错误都会向日志中抛出......
  • 适用于win10和win7的electron窗口毛玻璃特效
    为了使electron的窗口炫起来,可以通过以下方式添加毛玻璃特效,开篇先上一张效果图。话不多说,上代码及使用说明:一、支持平台Windows7、Windows10(stable)64位二、代码拉取及启动示例gitclonehttps://gitee.com/lykiao/electron-vibrancy-windows.gitcdelectron......