Hello, I have problem with my visual studio project(VS2012). My windowsform application open Autocad Electrical 2013
and do some jobs for example print documents. It has worked perfect when I started the application from inside
visual studio, but after I was doing a build/publish command(so i can get a oneclickinstaller) the application wont work no more I have tryed everything. Im getting the fault COM Exception was unhandled when Im trying to start autocad electrical from the code.
I have reference the two dlls: Autodesk.AutoCAD.Interop.dll, Autodesk.AutoCAD.Interop.Common.dll from folder ObjectARX 2013. Does anyone have any ideas what could be the fault?
Regards
Andreas Bergman
Development Engineer Automation
Hi,
I think blog post http://adndevblog.typepad.com/autocad/2012/05/cannot-instantiate-autocad-2010-from-an-external-net-a... should help you.
Hi,
Thanks for your reply but I have done a test with your recomended code and I still getting the same error(cant find library/dll). It seem that I cant get the Autocad Object. The line vAcadApp = new AutocadApplication is starting a process which I can see in taskmanager = acad.exe but the next line vAcadApp.visible = true starts the error.
Can the dll files be locked by Antivirus or any other program? What does a oneclick installer do with the operating system? This problem started when I run the oneclick installer who I made with publish function i Visual Studio.
Before that I startde my app with F5 on keyboard and It worked perfect.
I have reinstalled AutoCad Electrical 2013, reinstalled Visual Studio 2012. Maybe the last solution is reinstalling Win7.
I prefered not to reinstall win7 so any other ideas is welcome...
Regards Andreas
Hi,
I would recommend to track the call using procmon (microsoft free tool available somewhere on the internet):
- run procmon
- add filter on acad and your .net exe
- don't run tracking now
- run your exe in debug
- stop on the vAcadApp.Visible=true
- start procmon tracking
- step over the line in the debugger (get the exception)
- you should see a what registry access and file access this call made, I hope you'll find somewhere that your exe or acad is searching for a dll it can't find or load, this may give you additional clues.
Note: the log is often huge but, starting from the end, you should figure out where the error came from.
I know this is quite complicated, I would have been glad to give you a less tricky way to process, but since you're about to reinstall win7, you may try this before.
At a first thought it looks like your setup has registered a dll incorrectly, perhaps it has messed up your registry around COM registration x64/Win32, I just can't guess.
Hi,
Thank you very much for your replies!, procmon seems to be the kind of program that could help me, I have not solved the problem yet it might take me little time to understand how I can filter the data the best way, as you explained in last reply it is generating a lot of data. I think your guesses about the dll-files could been registered in a wrong way mixed up x86 and x64 is the reel problem. Is there any "shortcut-way" to reregister the autocad dll needed for getting the autocad object?
Regards
Andreas