Porting a working C# VS13 code (.NET 4.5) to work on XP

Post your .Net discussions here
Post Reply
miskol
Newbie
Posts: 0
Joined: Mon Jul 16, 2018 2:48 pm

Porting a working C# VS13 code (.NET 4.5) to work on XP

Post by miskol »

Hi,

I've able to have a working C# Console Application code built on VS2013 with .NET v4.5 framework on Windows 7. Unfortunately i was told i need it to work on XP SP3 platform. I've tried porting it but am not succesfull, please help.

1) Error
code line:
uint status = Imports.EnumerateUnits(out count, serials, ref serialsLength);

Error message:
An unhandled exception of type 'System.BadImageFormatException' occurred in PS3Kv9.exe
Additional information: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)

2) I've tried to change 'short' to 'int' based on other related post, but doesnt work for me.
post23509.html?sid=3ac3e3031b2bf0d016b9 ... 9d4#p23509

3) is it even possible? i understand that .NET supports for XP is only up to v4.0, and i have set up the Project to use .NET framework 4.

In summary, my code is working on .NET framework 4.5... but not on .NET framework 4

Please help, thank you.

Hitesh

Re: Porting a working C# VS13 code (.NET 4.5) to work on XP

Post by Hitesh »

Hi miskol,

Is your project set for an x86 platform or Any CPU? If it is Any CPU, please try building for an x86 platform.

Regards,

Post Reply