Tyler
Tyler

Reputation: 678

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

Upvotes: 0

Views: 2552

Answers (2)

RichieHindle
RichieHindle

Reputation: 281345

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).

Upvotes: 1

David Pfeffer
David Pfeffer

Reputation: 39823

It sounds like you're including the x86-only version of the SQLCE DLLs. You should include the x64 ones also.

Upvotes: 2

Related Questions