.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

32 bit dot net dlls in AutoCAD 64 bit on windows 7 64 bit machine - NetLoad

9 REPLIES 9
Reply
Message 1 of 10
Avadhut.Khavare
4719 Views, 9 Replies

32 bit dot net dlls in AutoCAD 64 bit on windows 7 64 bit machine - NetLoad

My 32 bit Dot net application is working proper on Windows Xp 32 bit environment.

I want to load 32 bit dot net dlls in AutoCAD 64 bit on windows 7 64 bit machine

 

Now we are moving to support AutoCAD 64 bit on windows 7 platform (I built my DLLS in x86 platform but is getting error as follows).

When i try to NETLOAD following error is coming

 

Cannot load assembly. Error details: System.BadImageFormatException: Could not
load file or assembly 'file:///D:\Sample
Projects\LoadACAD\LoadACAD\bin\Debug\LoadACAD.dll' or one of its dependencies.
An attempt was made to load a program with an incorrect format.
File name: 'file:///D:\Sample Projects\LoadACAD\LoadACAD\bin\Debug\LoadACAD.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()

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value
[HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure
logging.
To turn this feature off, remove the registry value
[HKLM\Software\Microsoft\Fusion!EnableLog].

 

9 REPLIES 9
Message 2 of 10

Just change your target to "Any CPU" when you build your app, also things work best if you download ObjectARX and target your references to the acdbmgd.ll and acmdg.dll located in the ObjectARX 2011\inc folder. (mark to "Not Copy" when you build).

Mike Robertson
FL. Dept. of Transportation
CADD Applications Developer
Message 3 of 10

Doing Any CPU settings it will create the DLLs in 64 bits and this will load the DLL without any Issue.

 

Issue is that i want to load 32 bit DLL as it is internally refering/loading 32 bit Dlls of another .Net Application.

 

Hope you got my point!

Message 4 of 10

Well, if the DLL you have to reference was specifically compiled targeting 32-bit CPU, then you cannot use it in your 64-bit AutoCAD process. Had your app is a stand-alone app, not an Acad add-in, then your app can just runa s 32-bit app (because of the must-reference 32-bit DLL) on Win 64-bit OS, just like other 32-bit apps run on Win64. However, you are developing in-process program for 64-bi AutoCAD, all code used must be 64-bit capable.

 

So, you either recompile that must-reference DLL to target Any CPU or x64, or choose not use that 32-bit specific DLL, if that DLL somehow uses 32-bit COM/native interop.

 

Here is an article that may be of help:

 

http://www.hanselman.com/blog/BackToBasics32bitAnd64bitConfusionAroundX86AndX64AndTheNETFrameworkAnd...

Message 5 of 10

The .net dlls I compile with "Any CPU" run fine on both 32 & 64bit without recompiling. I am targeting the reference dlls from the ObjectARX\inc folder (not a specific bit version).

Mike Robertson
FL. Dept. of Transportation
CADD Applications Developer
Message 6 of 10
maiterela
in reply to: Avadhut.Khavare

In my case the DLL I am calling from Autocad uses an 32bits activeX componente that I have not the source code.

Even if I put AnyCPU to my DLL, when Autocad try to load my DLL gives my an error.

 

Is there any solution?

 

Maitere

Message 7 of 10
norman.yuan
in reply to: maiterela

If your AutoCAD is 64-bit, then you cannot use 32-bit ActiveX component. Period. You need to find either 64-bit Activex Component, or a .NET version of equivalent.

Message 8 of 10


@maiterela wrote:

In my case the DLL I am calling from Autocad uses an 32bits activeX componente that I have not the source code.

Even if I put AnyCPU to my DLL, when Autocad try to load my DLL gives my an error.

 

Is there any solution?

 

Maitere


Unfortunately, not.  32 bit ActiveX controls cannot be used in 64 bit applications.

 

Having a dependence on ActiveX controls, especially those which you don't have control over, has always been a risky proposition.

 

 

Message 9 of 10
maiterela
in reply to: Avadhut.Khavare

I don't want to use Autocad32bits in a 64bits operating system. The autocad I am using is 64bit but I have an add-in that use 32bits activeX controls. Does these tools (Longbow Converter) help in cases too?

Message 10 of 10
norman.yuan
in reply to: maiterela

No, Longbow Converter DOES nto help you here: it is for running 32-bit AutoCAD with 64-bit OS. If you insist on using 64-bit AutoCAD with 64-bit OS (usually you should), you MUST give up the 32-bit activeX control. End of story.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost