I have a Windows 64bit system, and a C# app that uses an OleDbConnection to read Excel data via the 32bit version of AccessDatabaseEngine.exe COMponents since I have Office 32bit installed (as recommended by MSFT), and the 64bit version of AccessDatabaseEngine would not work with 32bit Office.
In order to get my C# app to work, I had to set "Prefer 32-bit" in the project build settings. This sets the compiler /platform anycpu32bitpreferred flag. There is no "preferred" about this on Intel platforms.
So everything runs fine. On my machine. Not on my boss' 64bit machine where he installed 64 bit Office.
I cannot find any app.config option to force 64bit. Is there one? Is it theoretically possible in the .NET load sequence that there could be one?
MSFT did not think this through. I should somehow be able to build an app that can work with both 32 and 64 bit versions of Office. Can I somehow using OleDbConnection?
I know about the CorFlags.exe /32bitpref- flag but this requires maintaining two versions of the binary.
Any ideas? Fixes? App.Config options?
You need to download the 64 bit version of the ODBC driver (it says access but it does excel driver too).
You will likely get a error saying you can not have both 32 bit and 64 bit installed at the same time, to get around this you must use the /passive flag
To install the Microsoft ACE OLEDB Provider 32-bit on a machine running Office 2010 64-bit:
- AccessDatabaseEngine.exe /passive
To install the Microsoft ACE OLEDB Provider 64-bit on a machine running Office 2010 32-bit:
- AccessDatabaseEngine_X64.exe /passive
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With