AutoCAD Map 3D Developer
Welcome to Autodesk’s AutoCAD Map 3D Developer Forums. Share your knowledge, ask questions, and explore popular AutoCAD Map 3D Developer topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Problem with SDK Sample in VB.NET

1 REPLY 1
SOLVED
Reply
Message 1 of 2
dwolford
2159 Views, 1 Reply

Problem with SDK Sample in VB.NET

I have AutoCAD Map 3D 2011, VB Express 2010, AutoCAD 2011 ObjectARX SDK, AutoCADMAP 3D 2011 SDK.  I am familiar with VBA and earlier versions of VB, but not with AutoCAD.

 

I am just trying to get my feet wet using VB Express and AutoCAD together, so I am trying to get some of the DOT.NET samples in the AutoCAD 2011 ObjectARX SDK to compile and run in AutoCAD.  I am currently trying the sample "ENTS" but I am receiving the following warning: "Warning 1 Load of property 'ReferencePath' failed.  Cannot add '..\..\..\inc' as a reference path as it is relative. Please specify an absolute path. Ents".  I have (I believe) thoroughly checkted my included references and the paths (acdbmgd, acmgd, System).  It does compile the Ents.dll though.

 

In AutoCAD I use "netload" at the command prompt to load the Ents.dll and I receive the following information.

Command: netload
Cannot load assembly. Error details: System.BadImageFormatException: Could not
load file or assembly 'file:///F:\Download\AutoCAD 2011
ObjectArx\Complete\samples\dotNet\Ents\bin\Ents.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:///F:\Download\AutoCAD 2011
ObjectArx\Complete\samples\dotNet\Ents\bin\Ents.dll'
   at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase,
Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark,
Boolean throwOnFileNotFound, Boolean forIntrospection)
   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.InternalLoadFrom(String assemblyFile, Evidence
securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm,
Boolean forIntrospection, StackCrawlMark& stackMark)
   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].

Command:

 

I have tried some of the other samples and I receive basicaly the same errors.  Thanks

 

Dan

1 REPLY 1
Message 2 of 2
dwolford
in reply to: dwolford

I solved my problems, there were two.

 

1.) Resolve the "ReferencePath" problems.

      The original "Ents.vbproj" file has the following text in the file that points to the relative file reference to the location  that I downloaded the AutoCAD 2001 SDK.  The original text shown below in RED needs to be changed to my current install location for AutoCAD Map 3D 2011 to point to the installed DLLs as shown in BLUE.

Original with Relative Path Location

<ReferencePath>..\..\..\inc;..\..\..\inc-win32;..\..\..\inc-x64</ReferencePath>

New with Fixed Path Location

 <ReferencePath>C:\Program Files\Autodesk\AutoCAD Map 3D 2011</ReferencePath>

 

2.) Error details: System.BadImageFormatException

    To solve this problem I needed to edit the file "C:\Program Files\Autodesk\AutoCAD Map 3D 2011\acad.exe.config" to enable the Legacy text in that file that is currently commented out.  I changed the original to that shown below in blue.

<configuration>
  <startup useLegacyV2RuntimeActivationPolicy="true"> <supportedRuntime version="v4.0"/> </startup>
 
 <!--All assemblies in AutoCAD are fully trusted so there's no point generating publisher evidence-->
 <runtime>
  <generatePublisherEvidence enabled="false"/>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"><probing privatePath="Fdo\bin;Plugins\Workflow\Activities"/></assemblyBinding></runtime>
</configuration>

Thanks to Norman Yuan for posting the answer to the second problem in the link below.

http://forums.autodesk.com/t5/AutoCAD-Map-3D-Developer/AcMapMap-problem-in-Civil3d-2011/m-p/2800906

Dan

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

Post to forums  

Autodesk Design & Make Report

”Boost