简体   繁体   中英

Make a C# program with .net Framework 4.5.2 work in Windows XP

I made a C# program for my work with .net Framework 4.5.2 because the requirements were that it just has to run at the newest Windows version. But in the end of my project it became clear that program hast to run on older OS like Win XP. Because we have some older terminal pcs and CNC-machines with Win XP at work.

So I figured out, that the newest or the last version of .net that runs on XP is 4.0. I made a copy of my program and tried to downgrade it in Visual Studio to .net 4.0.

Unfortunately when I run my program it showes the GUI for a few seconds and then it chrashes with a BadImageFormatException in System.Windows.Forms.dll even it is a WPF project.

Do I have options to solve this problem or isn´t there any possibility to solve this without making to many changes in the code? I thought about making it runable on browser. But I have no idea how big this construction area will get. I think I did my best to make a clear cut between the GUI and the logic in the program but I´m afraid to do this.

BadImageFormatException usually means you are running a 64bit assembly in a 32bit OS

If this is your case, switching Target to x86 and recompiling should produce a working program.

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