1

I am adding reference to Interop.ADOX.dll in my class library project "ABCD" in C#. When I built the project it builds fine. I can also access classes and functions provided by Interop.ADOX.dll. But when I run the exe which uses my dll "ABCD", it throw error : "Could not load file or assembly 'Interop.ADOX, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified."

I tried creating a separate sample class library and adding reference to the Interop.ADOX.dll and that works fine. No errors. So there is nothing wrong with the Interop.ADOX.dll file.

Also I know somehow in my project structure it is not able to find the Interop.ADOX.dll file and hence unable to load it. So far I tried copying them at all the possible locations that I thought it might be trying to access it from but that did not work... Any suggestions that I can try out?


I found out something. In the project properties, Build Tab, when I chose platform target as any CPU then it throws error. But if I chose x86 it works fine. Why?

ShalakaV
  • 25
  • 1
  • 6
  • 1
    That's not entirely abnormal, if you have to then set its "Embed Interop Types" property to False. And sure, trying to use a COM library from the previous century can only work when you target x86. – Hans Passant Dec 23 '14 at 17:30
  • So then should I download the 64 bit version? Is there another way to fix it? – ShalakaV Dec 23 '14 at 18:40
  • 1
    Don't download anything and don't use a file you found lying around. Interop assemblies are automatically generated when you add a COM reference. Project + Add Reference, COM tab, pick one of the "Microsoft ADO Ext. x.x for DDL and Security". Where x.x is the version number. Version 2.8 is the current version, 6.0 is very old. – Hans Passant Dec 23 '14 at 18:44
  • This might be related, I used ADODB class to create connection. My connection string looks like this: string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0}", qdbFilePath); But it is throwing the "Provider cannot be found. It may not be properly installed." error. Any idea? – ShalakaV Dec 29 '14 at 01:01

0 Answers0