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

Cannot load assembly on 64-bit Windows 7

9 REPLIES 9
Reply
Message 1 of 10
AlexB58
5191 Views, 9 Replies

Cannot load assembly on 64-bit Windows 7

The program is written with VS2008 Express for Acad2010 32-bit on Windows XP. Works OK.

After transferring to 64-bit Windows 7 (Acad2010) with corresponding changes of all AutoCAD references to 64-bit, I'm getting:

---------------------
Cannot load assembly.

Error details: System.BadImageFormatException: Could not
load file or assembly 'file:///C:\vbnet\DLL\VBApp3.dll' or
one of its dependencies. An attempt was made to load a program with an
incorrect format.
File name: '///C:\vbnet\DLL\VBApp3.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].

-------------------------

I didn't succeed in finding [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD).
Actually I found
[HKLM\Software\Microsoft\Fusion,
not the rest. Where it could be?

What you think can cause this problem? Wrong reference?

Thank you in advance,

Alex
9 REPLIES 9
Message 2 of 10
Anonymous
in reply to: AlexB58

Is the CopyLocal property for all AutoCAD assemblies set to false?

Are you using the AutoCAD assemblies from the SDK, or the
ones from the AutoCAD program/root folder?

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2010

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

wrote in message news:6354788@discussion.autodesk.com...
The program is written with VS2008 Express for Acad2010 32-bit on Windows XP.
Works OK.

After transferring to 64-bit Windows 7 (Acad2010) with corresponding changes of
all AutoCAD references to 64-bit, I'm getting:

---------------------
Cannot load assembly.

Error details: System.BadImageFormatException: Could not
load file or assembly 'file:///C:\vbnet\DLL\VBApp3.dll' or
one of its dependencies. An attempt was made to load a program with an
incorrect format.
File name: '///C:\vbnet\DLL\VBApp3.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].

-------------------------

I didn't succeed in finding [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD).
Actually I found
[HKLM\Software\Microsoft\Fusion,
not the rest. Where it could be?

What you think can cause this problem? Wrong reference?

Thank you in advance,

Alex
Message 3 of 10
AlexB58
in reply to: AlexB58

CopyLocal property for all AutoCAD assemblies were set to False.
I was using *.tlbs from Common Files\Autodesk Shared
and dlls from AutoCAD root, not from Object ARX SDK.

By the way, is there a difference from where assemblied added and what source is better:
SDK or Common Files\Autodesk Shared with AutoCAD root folder.
And last question: is it important to set CopyLocal to False?

Thank you,
Alex
Message 4 of 10
Anonymous
in reply to: AlexB58

Hello AlexB58,
Is your project set to compile for "AnyCPU"? If not, if you compile on 32bit
it won't run on 64bit.

To set this goto Project Properties, then the Compile tab, select the "Advanced
Compile Options..." button. Down near the bottom is a dropdown to select
the CPU to target.

> CopyLocal property for all AutoCAD assemblies were set to False.
> I was using *.tlbs from Common Files\Autodesk Shared
> and dlls from AutoCAD root, not from Object ARX SDK.
> By the way, is there a difference from where assemblied added and what
> source is better:
> SDK or Common Files\Autodesk Shared with AutoCAD root folder.
> And last question: is it important to set CopyLocal to False?
> Thank you,
> Alex
Message 5 of 10
AlexB58
in reply to: AlexB58

In Compile tab I have Platform: Active (any CPU) – the only option available in combo box.
Advanced Compiler Setting shown on attached image

Alex
Message 6 of 10
Anonymous
in reply to: AlexB58

Hello AlexB58,
Sorry, thought this was a .NET addin. It's been awhile since I worked with
C++ but I imagine the Custom constant "Win32=True" would be causing your
trouble. (although I don't know the answer since I haven't dealt with 64bit
ObjectARX coding.)

> In Compile tab I have Platform: Active (any CPU) – the only option
> available in combo box. Advanced Compiler Setting shown on attached
> image
>
> Alex
>
Message 7 of 10
AlexB58
in reply to: AlexB58

Thank you all for support.
I’ll try to rebuild the application on Windows 7 from scratch using Copy-Paste and Add existing Items, maybe that will help. I already tried to import forms (the application has one form), got only form module code without Form vb.[design].
Is there a way for importing form in VB.net similar to VB6 (add existing form)?

Thanks again,
Alex
Message 8 of 10
Anonymous
in reply to: AlexB58

Where did the Win32=True come from?

To answer the other question, yes you should use the
assemblies from the SDK, not the ones from the program
folder.

The assemblies for COM interop could be the problem.

Is there a 32 bit version of AutoCAD installed on the same
system?

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2010

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

wrote in message news:6355539@discussion.autodesk.com...
In Compile tab I have Platform: Active (any CPU) - the only option available in
combo box.
Advanced Compiler Setting shown on attached image

Alex
Message 9 of 10
matus.brlit
in reply to: AlexB58

Why do you suggest using the dlls from SDK? I'm using the ones from Acad root folder without any problems (so far).
Message 10 of 10
Anonymous
in reply to: AlexB58

The reason you should use the assemblies from the SDK is
because they've been modified to eliminate any dependence
on AutoCAD's native DLLs, which allows them to be loaded
into Visual Studio (which will happen if you have a designable
control that references types from those assemblies).

If you use the distribution assemblies, and you try to create
a form or control that references an AutoCAD type from any
code called from its constructor, you'll get a WSOD when you
try to open the control in the designer.

The fact that you've not had the problem doesn't mean that
it doesn't exist, you just haven't hit it yet.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2011

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

wrote in message news:6390644@discussion.autodesk.com...
Why do you suggest using the dlls from SDK? I'm using the ones from Acad root
folder without any problems (so far).

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