简体   繁体   中英

System.Data.SqlServerCe.dll is not a valid Win32 program

I am developing a C# program with visual studio that makes use of the sql compact library. On the developing computer everything works like a charm but on my home computer that has an almost fresh win8 installment I get a System.BadImageFormatException: is not a valid win32 program and I have no clue why.

I have added the Microsoft.SqlServer.Compact package with nuget. this package includes the System.Data.SqlServerCe.dll.

I have also seen on my development computer in the output window of visual studio that the System.Data.SqlServerCe.dll is loaded from GAC. Since my home computer has a fersh win8 installment it does not have the System.Data.SqlServerCe.dll in its GAC but since I have added the Microsoft.SqlServer.Compact package with nuget that should not be problem right?

The problem is probably that your program or one of it's dependancies is 64 bit and you are running it on a 32-bit computer. Go to the project properties, and set the "platform target" to either "Any CPU" or "x86" if you are planning to run it on 32-bit systems.

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