.NET

Reply
Active Member
Avadhut.Khavare
Posts: 6
Registered: ‎02-01-2011
Message 1 of 10 (2,961 Views)

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

2961 Views, 9 Replies
02-01-2011 05:16 AM

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].

 

Distinguished Mentor
michael.robertson
Posts: 590
Registered: ‎03-18-2008
Message 2 of 10 (2,945 Views)

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

02-01-2011 08:19 AM in reply to: Avadhut.Khavare

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
Active Member
Avadhut.Khavare
Posts: 6
Registered: ‎02-01-2011
Message 3 of 10 (2,903 Views)

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

02-02-2011 02:45 AM in reply to: Avadhut.Khavare

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!

*Expert Elite*
norman.yuan
Posts: 964
Registered: ‎04-27-2009
Message 4 of 10 (2,880 Views)

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

02-02-2011 08:02 AM in reply to: Avadhut.Khavare

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...

Distinguished Mentor
michael.robertson
Posts: 590
Registered: ‎03-18-2008
Message 5 of 10 (2,837 Views)

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

02-03-2011 04:00 AM in reply to: Avadhut.Khavare

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
Active Member
maiterela
Posts: 9
Registered: ‎11-12-2012
Message 6 of 10 (1,396 Views)

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

11-13-2012 03:20 AM 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

*Expert Elite*
norman.yuan
Posts: 964
Registered: ‎04-27-2009
Message 7 of 10 (1,386 Views)

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

11-13-2012 06:26 AM 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.

Valued Mentor
DiningPhilosopher
Posts: 370
Registered: ‎05-06-2012
Message 8 of 10 (1,331 Views)

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

11-19-2012 12:18 AM in reply to: maiterela

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.

 

 

Active Member
maiterela
Posts: 9
Registered: ‎11-12-2012
Message 9 of 10 (1,010 Views)

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

03-05-2013 12:18 AM 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?

*Expert Elite*
norman.yuan
Posts: 964
Registered: ‎04-27-2009
Message 10 of 10 (861 Views)

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

03-05-2013 06:27 AM 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.

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community