Hi,
Our application DLL works fine in development PC but not loads in other PCs. There are no error messages. We where using AutoCAD 2012 & Visual studio 2010. The project is a class library and it contains a class implementing initilize and terminate methods. Also it contains many autocad commands and some .NET forms which will be invoked from the commands.
Netlod completes without any message. But the commands are not available, neither the initilize method runs.....
Other details:
AutoCAD : 2012
OS : windows 7 both 32 & 64bit [we tried both]
.NET framework targeted: 3.5
Type: Class lib
Reference : Acdbmgd.dll & acmgd.dll from ObjectARX >> inc
Please help.
Regards,
Shijith
Solved! Go to Solution.
Solved by spu. Go to Solution.
@spu wrote:
...
Reference : Acdbmgd.dll & acmgd.dll from ObjectARX >> inc
...
Reference settings must be Copy Local = False
Also build solution to Release configuration (not to Debug)
AutoCAD 2012 request .NET 4.0
Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"
Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Hi,
Thanks for the advice. But still I am not able to run it.
All the mentioned settings are already presend other than NET version 4.
When i changed the targeted framework to .NET 4,100's of build errors ike the following is generated. Code is not building, if chaged to target 3.5 everything builds correctly.
"Type or namespace name 'EditorInput' does not exist in the namespace 'Autodesk.AutoCAD' (are you missing an assembly reference?"
We have some other .NET dlls which lods on this machines fine. Which is older and refered to AutoCAD 2010 dlls while building.
Please advice how to use the .NET 4 autocad dlls reference .r did I had to use the reference to old version reference...
Regards,
shijith
Did you enclosed the code in IExtensionApplication.Initialize() in a try{...}catch{...} block? any exception occured in Initialize() fails the assembly loading, hence make the command methods in it unavailable.
Norman Yuan
Hi,
I added the try catch and targeted to version 4 of framework still neither any message nor any commands available.
Regards,
Shijith
Hi,
Some things to check:
Finally, post your code here, specially the Initialize/terminate method
Gaston Nunez
@spu wrote:Hi,
I added the try catch and targeted to version 4 of framework still neither any message nor any commands available.
Regards,
Shijith
Per chance, was the catch{} block displaying any message when it was hit? An empty catch{} block is the same as no catch{} block (or try{} block). If your commands are not being registered, it could be an exception being raised inside of your Initialize() method or some code called from there, or it could also be a static field or variable initialization which will happend when AutoCAD creates the instance of the class that implements IExtensionApplication, which is before it calls Initialize(). Unfortunately, those exceptions can't be caught by your code unless you use a static constructor to do all initialization, rather thah doing it directly in the static member/variable declaration.
In otherwords:
public class MyApp : IExtensionApplication { public void Intiialize() { try { // do all initialization here } catch( System.Exception ex ) { Console.Beep(); Application.DocumentManager.MdiActiveDocument .Editor.WriteMessage( "\nException in Initialize(): {0}", ex.ToString() ); } } /// the call to GetMyString() runs before Initialize() /// is called and you can't easily catch an exception /// thown by the called API, so rather than do this: static string MyString = GetMyString(); /// Use a static constructor instead: static MyApp() { try { MyString = GetMyString(); } catch( System.Exception ex ) { Console.Beep(); Application.DocumentManager.MdiActiveDocument .Editor.WriteMessage( "\nException in Initialize(): {0}", ex.ToString() ); } } }
The other thing I don't think anyone mentioned, is whether you have any CommandClass attributes in your assembly. IF you do, you must have one for every class that has command methods.
Hi,
Thanks for gasty1001 & DiningPhilosopher for their very valuable comments. Finally I solved it.
I tried all the suggestions by both of you and still there was no error message and it loads but nothing happens.
This is how I solved it.
I created another project and added a initial routine and tested on the PC that have problem. It works fine then
added a test command ...works fine
added a pallet.....works fine
added a form ....works fine
added a Crystal report and viewer....BANG got the error message.....Please see the attached
In the error message it show me to added a Reg Key for meore info and to log it.
set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
I done it. I loaded my real dll still no error message or not running....
I installed CR 64bit redistribution for VS2010....
Thats it; the test as well as the original starts working .....
We where converting one of our legacy VBA application to .Net and it is a huge application which includes Commands, Forms, Crystal Reports, Pallets, Calling web services & other custum objects and toolbars. It is started with AutoCAD 2008 so code was huge. I commented many part but still i don't know why it don't shown any error message while Crystal reports where not present. May be it not loads at startup. But there should be some error message.........
I hope these steps and this entire post will helpful to somebody.
Thank you all .....gasty1001 DiningPhilosopher Alexander.Rivilis norman.yuan.....
Regards,
Shijith