How can a .NET application work with 32-bit and 64-bit Office?

I have a 64-bit Windows system and a C # application that uses OleDbConnection to read Excel data through the 32-bit version of AccessDatabaseEngine.exe. Components, since I have Office 32bit installed (as recommended by MSFT) and the 64-bit version of AccessDatabaseEngine will not work with 32-bit Office.

To make my C # application work, I had to install “Prefer 32-bit” in the project build settings. This sets the compiler / platform flag to anycpu32bitpreferred. On Intel platforms, there are no "preferred."

So everything is working fine. On my car. Not on my boss's 64-bit machine, where he installed 64-bit Office.

I can not find any app.config parameter for forced 64-bit. Is there any? Is it theoretically possible in the .NET boot sequence that there can be one?

MSFT did not think about it. I have to somehow create an application that can work with both 32 and 64-bit versions of Office. Can I use OleDbConnection somehow?

I know about the flag CorFlags.exe / 32bitpref-, but this requires support for two versions of the binary file.

Any ideas? Corrections? App.Config options?

+5
source share
2 answers

You need to download the 64-bit version of the ODBC driver (it talks about access, but also does the excel driver).

, , 32-, 64- , , /

32- Microsoft ACE OLEDB Provider 64- Office 2010:

  • AccessDatabaseEngine.exe/passive

64- Microsoft ACE OLEDB Provider 32- Office 2010:

  • AccessDatabaseEngine_X64.exe/passive
+3

ODBC Excel COM- AccessDatabaseEngine. 32/64 .

0

All Articles