dbroada Posted May 5, 2010 Share Posted May 5, 2010 I have installed microsoft's free Visual Basic 2010 Express in an attempt to look at using VB.NET with AutoCAD. I have followed an example I found on www.cadalyst.com and have compiled my .dll file. I have now used NETLOAD to find the .dll but got this output... Command: NETLOADCannot load assembly. Error details: System.BadImageFormatException: Could not load file or assembly 'file:///D:\DavesProjects\VB.NET(New)\HelloWorld\HelloWorld\HelloWorld\obj\Relea se\HelloWorld.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:///D:\DavesProjects\VB.NET(New)\HelloWorld\HelloWorld\HelloWorld\obj\Relea se\HelloWorld.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]. can anybody interpret this for me? Even nicer, can anyone suggest what I should do to progress? Oh, and my machine has ONLY ever had AutoCAD 2008 Electrical on it, I cannot have picked up the references from the wrong install folder. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted May 5, 2010 Share Posted May 5, 2010 Like you I am looking at going to .net the problem may be "This assembly is built by a runtime newer than the currently loaded runtime" Just a stab in the dark if VS is 2010 but autocad is 2009 then message makes sense need newer run time library for Autocad The 2011 nightmare vba ? is about to start is it supported ? I am lucky we have some VS experts where I work but have not tapped into their help wil ask them tomorrow about this request (in AUS) Quote Link to comment Share on other sites More sharing options...
dbroada Posted May 5, 2010 Author Share Posted May 5, 2010 I wondered whether VS was too new for my version of AutoCAD but you have to add ACDBMGD.DLL & ACMGD.DLL as references into VS to (as I understand it) access the AutoCAD object. Since they were in the ACAD folder I had hoped they would be compatible with themselves! We do hjave a couple of programmers here and I am sure at least one of them will know a bit about .NET but I'm the only AutoCAD person with ANY programming experience. I am not desperate with this issue as the company (worldwide) standard is 2008 and is unlikely to change in the near future. What I am afraid of is that the next standard will be v201x without any VBA compatibility. I'm just trying to cushion the blow when (if) it comes. As I understand it, VBA is no longer supported but can still be used with an AutoDesk download. I guess at some time they might drop that download and then we (here) will be in big trouble. I have seen people here convert their VBA to VB.NET so I know it can be done but the forum search engine makes locating example very difficult! Quote Link to comment Share on other sites More sharing options...
dbroada Posted May 5, 2010 Author Share Posted May 5, 2010 I think the problem may be that I am compiling into net framework 4,0. I tried to compile to 3,5 just before I left work this evening but that still didn't work. Can anyone confirm what release of net framework I should be targeting with v2008? and a sort of related question, This is where my programming knowledge lets me down - how is the net framework added to AutoCAD? Quote Link to comment Share on other sites More sharing options...
BIGAL Posted May 6, 2010 Share Posted May 6, 2010 I remember some articles about setting up the library links here Do an advanced search for visual studio tick Vba lisps forum only, theres a lot of helpfull links that come up and I remember now theres a down load for Visual studio. It talks about setting up your VS. I think I downloaded from the Autodesk site the files are called DE115-2 DE205-2 DE201-2 DE21-2 (allpdf's) the first does the hello world tutorial so if that works your code should then work. If you can not find them post here and I will email to you (200kb each) Quote Link to comment Share on other sites More sharing options...
dbroada Posted May 6, 2010 Author Share Posted May 6, 2010 thanks, I'll have a look when I get to work. The boss is in today so won't have quite as long to fiddle with coding today (he lets me, but not ALL the time)! Quote Link to comment Share on other sites More sharing options...
fixo Posted May 6, 2010 Share Posted May 6, 2010 See post #3 (by articad) from there it may helps: http://discussion.autodesk.com/forums/thread.jspa?messageID=6368245 ~'J'~ Quote Link to comment Share on other sites More sharing options...
dbroada Posted May 6, 2010 Author Share Posted May 6, 2010 Thanks Fixo - I discovered that last night too. It didn't fix my problem then but I may have rushed it and , well you know, something. Anyway new day, new ideas. I'll keep trying (for now). Quote Link to comment Share on other sites More sharing options...
dbroada Posted May 6, 2010 Author Share Posted May 6, 2010 WOOHOOO!!!!! I had to compile to Net framework 2.0 to get it to load. I am seeing lots of errors in the VS GUI but at least it loads and works now so I can start making a bit of progress. Quote Link to comment Share on other sites More sharing options...
SEANT Posted May 6, 2010 Share Posted May 6, 2010 . . . . I have seen people here convert their VBA to VB.NET so I know it can be done but the forum search engine makes locating example very difficult! With regard to searching for .NET examples: It does seem like this forum's search function baulks at terms like VB.NET and/or C#. The word “transaction” is a fairly common term, though, and will return some hits for examples. Also, the “Through the Interface” blog is an excellent resource for .NET programming within AutoCAD. This post, for instance, may be of some interest. http://through-the-interface.typepad.com/through_the_interface/visual_basic/ Quote Link to comment Share on other sites More sharing options...
fixo Posted May 6, 2010 Share Posted May 6, 2010 WOOHOOO!!!!! I had to compile to Net framework 2.0 to get it to load. I am seeing lots of errors in the VS GUI but at least it loads and works now so I can start making a bit of progress. Congrats Keep trying ~'J'~ Quote Link to comment Share on other sites More sharing options...
dbroada Posted May 10, 2010 Author Share Posted May 10, 2010 a slight update - I can compile to net framework 3.5 and all is well. I can now at least write "Hello World" on the command line or on the screen. All I have to do now is find a project that requires it..... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.