简体   繁体   中英

.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). 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. 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). When I decompile my .NET 4.0 executable I see it really is a NET40 application and x86 compiled. Any ideas?

You could try to remove the sku optional attribute from the app.config file. See: https://docs.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/startup/supportedruntime-element

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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