.NET

Reply
Active Member
Markus Fritschi
Posts: 7
Registered: ‎12-23-2007
Message 1 of 5 (257 Views)
Accepted Solution

AutoCAD 2008 has problems with .NET

257 Views, 4 Replies
12-23-2007 01:57 AM
I need some Help from AutoCAD:

I just downloaded the trial version AutoCAD 2008 to test our .NET application with this new version.
It was not possible to make it running!!
The new acmgd.dll seems not to work correctly.

To find out where the error came from I loaded the old DLL's 'acdbmgd.dll' and 'acmgd.dll' from AutoCAD 2006 and everything worked correctly!
The only annoying thing is the message in the AutoCAD commandline: 'acmgd.dll' is incompatible with this version of AutoCAD.

To reproduce the error make the following:

Take Lab7 Demo Code from AutoCAD 2007 .NET Training.3

Private Sub AddContextMenu()
Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
Try

m_ContextMenu = New ContextMenuExtension()
m_ContextMenu.Title = "Acme Employee Menu"

Dim mi As MenuItem
mi = New MenuItem("Create Employee")
AddHandler mi.Click, AddressOf CallbackOnClick
m_ContextMenu.MenuItems.Add(mi)

Application.AddDefaultContextMenuExtension(m_ContextMenu)
Catch ex As System.Exception
ed.WriteMessage("Error Adding Context Menu: " + ex.Message)
End Try
End Sub

You will be confronted with the following errors:

1) "Cannot find the method on the object instance." ( debug information )
2) Operation is not valid due to the current state of the object.
3) Error Message of Lab7 Class: Error Adding Context Menu: Operation is not valid due to the current state of
the object.

Questions:

a) Does anybody know if there are new dll's from AutoCAD?
b) Why does anybody know about these errors? ( perhaps i am the only person who works with these dll's )
c) are workarounds available?
I have noticed no such issues with those DLLs.

Did you change both the acmgd.dll and acdbmdg.dll to load the Autocad 2008 version, and did you set "Copy Local" to FALSE for both of them?

And also, you are trying to compile the COMPLETE Lab 7 code, right? If you are only trying to compile the little snippet shown in your post, then it's no wonder it's not working for you. That little snippet is designed to work with other elements in the code, and if you are missing everything else, then you would expect to see errors.
*Expert Elite*
Sinc
Posts: 6,207
Registered: ‎11-18-2006
Message 2 of 5 (257 Views)

Re: AutoCAD 2008 has problems with .NET

12-23-2007 06:43 AM in reply to: Markus Fritschi
I have noticed no such issues with those DLLs.

Did you change both the acmgd.dll and acdbmdg.dll to load the Autocad 2008 version, and did you set "Copy Local" to FALSE for both of them?

And also, you are trying to compile the COMPLETE Lab 7 code, right? If you are only trying to compile the little snippet shown in your post, then it's no wonder it's not working for you. That little snippet is designed to work with other elements in the code, and if you are missing everything else, then you would expect to see errors.
Sinc
Active Member
Markus Fritschi
Posts: 7
Registered: ‎12-23-2007
Message 3 of 5 (257 Views)

Re: AutoCAD 2008 has problems with .NET

12-23-2007 08:07 AM in reply to: Markus Fritschi
This simple "Copy Local" was set to TRUE.
Setting it to FALSE made me very happy. Everything works fine!
Does this mean that our DLL works for both AutoCAD 2008 and AutoCAD 2006, because the DLL's are referenced by AutoCAD?
In other words:
when working with AutoCAD 2006, the dll's are taken from 'C:\Program Files\AutoCAD 2006\*mgd.dll' locations, working with AutoCAD 2008, dll's are taken from 'C:\Program Files\AutoCAD 2008\*mgd.dll' locations?

Thanks to sinc and a merry christmas
*Tony Tanzillo
Message 4 of 5 (257 Views)

Re: AutoCAD 2008 has problems with .NET

12-23-2007 11:07 AM in reply to: Markus Fritschi
You can find out if the same assembly will work on both releases by loading and testing it. If there are errors, then try making a separate build for 2008 which references its libraries.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2008
Supporting AutoCAD 2000 through 2008
http://www.acadxtabs.com

wrote in message news:5807568@discussion.autodesk.com...
This simple "Copy Local" was set to TRUE.
Setting it to FALSE made me very happy. Everything works fine!
Does this mean that our DLL works for both AutoCAD 2008 and AutoCAD 2006, because the DLL's are referenced by AutoCAD?
In other words:
when working with AutoCAD 2006, the dll's are taken from 'C:\Program Files\AutoCAD 2006\*mgd.dll' locations, working with AutoCAD 2008, dll's are taken from 'C:\Program Files\AutoCAD 2008\*mgd.dll' locations?

Thanks to sinc and a merry christmas
ADN Support Specialist
Daniel.Du
Posts: 276
Registered: ‎12-23-2008
Message 5 of 5 (129 Views)

Re: AutoCAD 2008 has problems with .NET

12-03-2013 12:32 AM in reply to: *Tony Tanzillo

Keep in mind, For autoCAD plugin development,  always set "Copy local" tp "False".



Daniel Du
Developer Technical Services
Autodesk Developer Network

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.