.NET

Reply
Mentor
mgorecki
Posts: 414
Registered: ‎09-23-2004
Message 1 of 7 (393 Views)

Netload Error, Starting From Scratch

393 Views, 6 Replies
06-29-2012 10:20 AM

Hello,

In the past, I've used a pre-packaged template to start my vb.Net code for AutoCad.  Today, I'm trying to just launch Visual Studio 2010 and start writing code from there.

What I;'ve done so far:

In the Project Properties, under the Debug tab, I've set the external program to AutoCad 2008\acad.exe (as well as a working directory)

Under the References tab I added acDbMgd and AcMgd from the ObjectARX 2020\inc-x64 folder.  I also added the Autodesk.AutoCAD.Interop and Autodesk.AutoCAD.Interop.Common dlls (also from the same folder)

 

I then wrote some simple code as a test.  I picked "Start Debugging" which launched AutoCad and I entered Netload and picked my .dll.

 

This is what came back:

NETLOAD Cannot load assembly. Error details: System.BadImageFormatException:
Could not load file or assembly
'file:///C:\Holding\acadtest\acadtest\bin\Debug\acadtest.dll' or one of its
dependencies. This assembly is built by a runtime newer than the currently
loaded runtime and cannot be loaded.
File name: 'file:///C:\Holding\acadtest\acadtest\bin\Debug\acadtest.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].

 

This is way over my head.  What did I leave out?  Are there more settings to set?  Any help would be greatly appreciated.

 

Thanks,

Mark

Mentor
mgorecki
Posts: 414
Registered: ‎09-23-2004
Message 2 of 7 (388 Views)

Re: Netload Error, Starting From Scratch

06-29-2012 10:28 AM in reply to: mgorecki

Ok, I went to the "Compile" tab and picked "Advanced Compile Options" and changed the Target framework from .NET Framework 4.0 to .NET Framework 3.5.  I saved and re-launched and now it seems to be working. 

Mentor
mgorecki
Posts: 414
Registered: ‎09-23-2004
Message 3 of 7 (386 Views)

Re: Netload Error, Starting From Scratch

06-29-2012 10:30 AM in reply to: mgorecki

The problem now is that I put in a break, but it is completely ignored.  The program runs, but I cannot get it to stop at the breakpoint.

Valued Mentor
fieldguy
Posts: 379
Registered: ‎03-31-2005
Message 4 of 7 (386 Views)

Re: Netload Error, Starting From Scratch

06-29-2012 10:32 AM in reply to: mgorecki

I don't have acad 2008 to test.  Change the "target framework" under Project->"projectname" Properties->Compile->Advanced Compile Options at the bottom.  The default is 4 - I have to use 3.5 for acad 2011.  There are posts here that say 2.0 should be used for acad 2008.

Moderator
Alexander.Rivilis
Posts: 1,446
Registered: ‎04-09-2008
Message 5 of 7 (382 Views)

Re: Netload Error, Starting From Scratch

06-29-2012 10:41 AM in reply to: mgorecki

mgorecki wrote:
[,,,]

In the Project Properties, under the Debug tab, I've set the external program to AutoCad 2008\acad.exe (as well as a working directory)

Under the References tab I added acDbMgd and AcMgd from the ObjectARX 2020\inc-x64 folder.  I also added the Autodesk.AutoCAD.Interop and Autodesk.AutoCAD.Interop.Common dlls (also from the same folder)[,,.]


What version of ObjectARX are you using??? (newest  version is 2013, but you have to use ObjectARX 2008 if your's assembly need to work with AutoCAD 2008). Also you can set Target framework to .NET Framework 2.0 and for all AutoCAD assembly set Copy Local to False. Also if your's version of  AutoCAD 2008 is x64 - set Platform target to Any CPU or to x64.

I hope that help you.


Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

Mentor
mgorecki
Posts: 414
Registered: ‎09-23-2004
Message 6 of 7 (379 Views)

Re: Netload Error, Starting From Scratch

06-29-2012 10:47 AM in reply to: mgorecki

Ok, I went to the Debug tab and changed the external program from AutoCad 2008 to AutoCad 2010 and now the debugger stops at the breakpoints.

Mentor
mgorecki
Posts: 414
Registered: ‎09-23-2004
Message 7 of 7 (378 Views)

Re: Netload Error, Starting From Scratch

06-29-2012 10:48 AM in reply to: mgorecki

Thank you both for your information.

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!