简体   繁体   English

.NET 4.0 编译的应用程序尝试加载 .NET 4.8 框架

[英].NET 4.0 compiled application attempts to load .NET 4.8 framework

I have a legacy WPF application where I had to do some adjustments and which must be compiled to .NET 4.0 (because it is running on some WinXP production machines - nicely isolated, don't worry about that) and .NET 4.8 (Win10/11).我有一个旧版 WPF 应用程序,我必须在其中进行一些调整,并且必须将其编译为 .NET 4.0(因为它在一些 WinXP 生产机器上运行 - 很好地隔离,不用担心)和 Z303CB0EF9EDB95082D64BBBE8(Win25D95082D179)61BBBE8。 . I joined the two branches and upgraded them to a solution with multi-targeting SDK projects ( NET40 ; NET48 ), made sure the PDBs are still in native format and the target platform x86 - everything works fine on my machine.我加入了这两个分支并将它们升级为具有多目标 SDK 项目( NET40 ; NET48 )的解决方案,确保 PDB 仍然是本机格式和目标平台x86 - 在我的机器上一切正常。 But on these production machines a dialog appears informing me that the application depends on .NET 4.8 and asking me whether I would like to install it (which of course is not possible - .NET 4.8 cannot be installed on WinXP).但是在这些生产机器上会出现一个对话框,通知我该应用程序依赖于 .NET 4.8 并询问我是否要安装它(这当然是不可能的 - .NET 4.8 无法在 WinXP 上安装)。 When I decompile my .NET 4.0 executable I see it really is a NET40 application and x86 compiled.当我反编译我的 .NET 4.0 可执行文件时,我发现它确实是一个 NET40 应用程序并编译了 x86。 Any ideas?有任何想法吗?

You could try to remove the sku optional attribute from the app.config file.您可以尝试从 app.config 文件中删除sku可选属性。 See: https://docs.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/startup/supportedruntime-element请参阅: https://docs.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/startup/supportedruntime-element

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM