Compiling Visual Studio C# for 64bit
I ran into an issue today because I am developing an application in Visual Studio on a machine that is 32bit. When I build the application and run on a 64bit it errors out.
I am using SQL Server Compact 3.5 to store a database. I throw the DLLs for SQL Compact 3.5 into the assembly so when it is installed, those DLLs come with开发者_开发百科 it. Is there a specific way I should build the project so it will work in 64bit?
Note : I get error : "System.BadImageFormatException" on the 64bit Machine
According to some googleing I should be able to change the Target CPU under Advanced Build Options but its not there in VS 2008
It sounds like you're including the x86-only version of the SQLCE DLLs. You should include the x64 ones also.
David's solution is correct, but if for some reason you're forced to use 32-bit DLLs then you should mark your code as targeting x86
rather than Any CPU
(via Project properties / Build / Platform target).
精彩评论