none
Problems with ACE Provider for Office 2010 64bit RRS feed

  • Question

  • I am currently writing an application using the ACE provider for Access and I recently upgraded to the 64bit version of Office 2010 and thought that at the same time I would now write my app to work in either 32bit or 64bit mode. This sounded reasonable enough. I created separate platforms for x86 and x64 in Visual Studio 2010. Sounds reasonable. Had separate build folders and built my application.

    I have the following connection string

    Provider=Microsoft.ACE.OLEDB.12.0;Data Source=****

    I am using 12 because the OLEDB driver thinks it is 12 although using 14 makes no difference. 

    Now when I run my test project in 32bit (x86) mode I get

    'Microsoft.ACE.OLEDB.12.0/14.0' provider is not registered on the local machine

    Now I can understand this, I'm running a 64bit version of Office on a 64bit machine and I'm compiling the app using the x64 platform. Again all reasonable I believe.

    So then I switch to x64 and I get the rather cryptic message box error:

    Cannot start test project '' because the project does not contain any tests.

    On further investigation the output from the tests is (I've removed my paths):

    Error loading ...Tests.dll: Unable to load the test container '....Tests.dll' or one of its dependencies. 
    
    If you build your test project assembly as a 64 bit assembly, it cannot be loaded. When you build your test project assembly, select "Any CPU" for the platform. 
    
    To run your tests in 64 bit mode on a 64 bit processor, you must change your test settings in the Hosts tab to run your tests in a 32 bit process. 
    
    Error details: Could not load file or assembly 'file:///....Tests.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format.

    Now this error message is just full of unanswerable questions as far as I can see...

    1) "If you build your test project as a 64 bit assembly it cannot be loaded" - does this mean MSTest doesn't support 64 bit at all?

    2) When you build your test project assembly, select "Any CPU" for the platform. - OK so does this mean that you can test 64 bit applications but MS Test must run in 32 bit mode. In which case will 64bit OLEDB drivers load when testing?

    3) "To run your tests in 64 bit mode on a 64 bit processor, you must change your test settings in the Hosts tab to run your tests in a 32 bit process" - the plot thickens, the 2 options you have in the Hosts tab are "Run tests in 64 bit process on 64 bit machine" and "Force tests to run in 32 bit process" - So if MSTest either doesn't support 64 bit or the test dll needs to be compiled in 32 bit WHY is there an option for 64 bit here at all? And if setting this setting to 32 bit allows me to "run my tests in 64 bit on a 64 bit machine" then what on earth does setting the 64 bit option allow me to do. All very strange.

    4) Having endevaoured to follow both pieces of advice I attempted to run again and got the even stranger

    Error loading ...Tests.dll: Unable to load the test container ...Tests.dll' or one of its dependencies. 
    
    Error details: System.BadImageFormatException: Could not load file or assembly Model, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
    
    An attempt was made to load a program with an incorrect format.

    The assembly Model is simply a project reference in the test project.

    Firstly sorry for posting this to multiple forums but this does cross several boundaries. Any help would be much appreciated in getting my app to work both 32bit and 64 bit.

    Thanks in advance for any help.

    Colin

    Saturday, April 24, 2010 9:25 PM

All replies