0

Gents,

I was wondering if there is any way to configure the autocad.exe.config file so it works with the 32 bits version of .net framework. I'm developing an application for autocad 2008 32 bits in a 64 bits machine (windows 7) that gets some data from an access database (32 bits) therefore I'm getting the infamous "'microsoft.ace.oledb.12.0' provider is not registered on the local machine" error. Looking for a solution I've found that the only way to solve this is to target x86 machine in VS, but Autocad can't load the application because is reading the .net configuration from framework64 folder.

Update: This is the error I get in the autocad command line when the x86 application is loaded:

Cannot load assembly. Error details: System.BadImageFormatException: Could not 
load file or assembly 
'file:///C:\@Documentos\Personales\CODING\AutoCad\vb.net\OleDBTest\ClassLibrary1
\bin\Debug\ClassLibrary1.dll' or one of its dependencies. An attempt was made 
to load a program with an incorrect format.
File name: 
'file:///C:\@Documentos\Personales\CODING\AutoCad\vb.net\OleDBTest\ClassLibrary1
\bin\Debug\ClassLibrary1.dll'
   at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, 
Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, 
Boolean throwOnFileNotFound, Boolean forIntrospection)
   at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, 
Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
   at System.Reflection.Assembly.LoadFrom(String assemblyFile)
   at Autodesk.AutoCAD.Runtime.ExtensionLoader.Load(String fileName)
   at loadmgd()
=== Pre-bind state information ===
LOG: User = GLOBAL\rodrigo.cortes
LOG: Where-ref bind. Location = 
C:\@Documentos\Personales\CODING\AutoCad\vb.net\OleDBTest\ClassLibrary1\bin\Debu
g\ClassLibrary1.dll
LOG: Appbase = file:///C:/Program Files/AutoCAD 2008/
LOG: Initial PrivatePath = NULL
Calling assembly : (Unknown).
===
LOG: This bind starts in LoadFrom load context.
WRN: Native image will not be probed in LoadFrom context. Native image will 
only be probed in default load context, like with Assembly.Load().
LOG: Using application configuration file: C:\Program Files\AutoCAD 
2008\acad.exe.Config
LOG: Using machine configuration file from 
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\config\machine.config.
LOG: Attempting download of new URL 
file:///C:/@Documentos/Personales/CODING/AutoCad/vb.net/OleDBTest/ClassLibrary1/
bin/Debug/ClassLibrary1.dll.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.
roco3d
  • 3
  • 2
  • 1
    Can you separate the Access code in a separate project targeted to 32 bit and keep the rest in a 64 bit targeted project??? (Just guessing) – Daniel Möller May 10 '13 at 22:24
  • So Autocad would load your 64 bit dll, and your 64 bit dll would read the 32 bit access dll. (I'm not sure if this is possible, but if nothing else shows up, I'd try) – Daniel Möller May 10 '13 at 22:26
  • Only the 64-bit version of that provider isn't available. You must thus be running the 64-bit version of Autocad. No, you cannot fix this, mixing bitness in one process isn't possible. Converting to another dbase is an obvious way ahead. – Hans Passant May 10 '13 at 23:20
  • What i've tried: any_cpu -> autocad loads the application, OleDbConnection.Open method throws the infamous error. x64 -> same as before. x32 -> autocad doesn't load the application. I'm thinking that my best chance to make this thing work is to move all database related code to vba but i have no idea how to connect both vba and vb.net – roco3d May 11 '13 at 00:45
  • I don't know, but maybe this could help. http://stackoverflow.com/questions/145803/targeting-both-32bit-and-64bit-with-visual-studio-in-same-solution-project – Daniel Möller May 17 '13 at 15:58

0 Answers0