AutoCAD from an external .NET application: System.IO.FileNotFoundException

AutoCAD from an external .NET application: System.IO.FileNotFoundException

Mahmoud.Abdelmoneam
Participant Participant
2,939 Views
13 Replies
Message 1 of 14

AutoCAD from an external .NET application: System.IO.FileNotFoundException

Mahmoud.Abdelmoneam
Participant
Participant

I ran the LoadableComponent project (Mentioned here by Kean Walmsley) in my machine successfully After Building with Visual Studio. Whenever I try to run it on another machine (Without Building with Visual Studio) I get this Exception:

 

 

System.IO.FileNotFoundException: Problem in loading application

at Autodesk.AutoCAD.Interop.IAcadApplication.GetInterfaceObject(String ProgID)

 

 

I did everything Kean said (RegAsm and everything) but nothing works.

 

My Machine: Windows 7 x64, AutoCAD 2014, Visual Studio 2010

Other Machines: Windows 7 x64, AutoCAD 2014

 

Things I tried:
Registry Permissions

Files UnBlock - To make sure they are not blocked by any program

Tried on Several Other Machines without Building in Visual Studio

 

Things I tried and Worked:
Installed Visual Studio on the other Machines, Built the Project, after several trials got it to work

 

I want to deploy the Application, so I don't want to build the code on other Machines.

 

Any help would be Appreciated.
Please Help Smiley Sad


Best regards,
Mahmoud AbdElMoneam
0 Likes
Accepted solutions (1)
2,940 Views
13 Replies
Replies (13)
Message 2 of 14

Mahmoud.Abdelmoneam
Participant
Participant
Accepted solution

Building the Application Inside AutoCAD Folder Solved it.


Best regards,
Mahmoud AbdElMoneam
0 Likes
Message 3 of 14

i_bherer
Explorer
Explorer

Could you elaborate on what building the Application Inside AutoCAD Folder means and how to do it?

 

I am starting out with all of this! I appreciate any help 🙂

0 Likes
Message 4 of 14

mahmoudabdelmoneam
Explorer
Explorer

As I remember, you set the build location inside the installation folder of Autocad.

0 Likes
Message 5 of 14

i_bherer
Explorer
Explorer

Are you referring to the output path located in the build tab of project properties? Also, are you referring to .exe build path or the .dll build path?

 

Thanks again!

0 Likes
Message 6 of 14

mahmoudabdelmoneam
Explorer
Explorer

The .dll yes, it needs several referances to build correctly, that's why u need to build into the installation folder.

0 Likes
Message 7 of 14

i_bherer
Explorer
Explorer

Hmm, this does not seem to work for me, when I try to build the solution, an error says access to the installation folder is denied!

0 Likes
Message 8 of 14

mahmoudabdelmoneam
Explorer
Explorer

Try to run visual studio as administrator.

0 Likes
Message 9 of 14

Ed__Jobe
Mentor
Mentor

I don't recommend building your app into any folder belonging to another app. If the app is updated or removed, you will lose part of your project. Also, the reason you have file access issues is that you are trying to write to areas of the C:\ drive that are protected, e.g. Program Filies. Running as Administrator bypasses Windows security. You can follow the steps in this tutorial on how to set up a new project. The tutorial is about creating a VS template, but the template is used to set up a new project. At the end are some tips for debugging the project.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 10 of 14

mahmoudabdelmoneam
Explorer
Explorer

Thanks for your reply. I agree with you completely. However, for this use case nothing else worked for me, and no one replied with a better solution yet.

0 Likes
Message 11 of 14

Ed__Jobe
Mentor
Mentor

Looking back at your first post, if ran regasm on your pc, and then you just copy the exe/dll to another pc, wouldn't you need to run regasm on the other pc too?

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 12 of 14

mahmoudabdelmoneam
Explorer
Explorer

I've worked on this project a long time ago, if I remember correctly, I think I used the installation itself to do this on users' machines.

0 Likes
Message 13 of 14

i_bherer
Explorer
Explorer

Hey,

Even after building in the project in AutoCAD directory, it does not work for me. I guess I didn't follow the step correctly. I think I will resort to utilizing the ActiveX interop object model to get internal data from AutoCAD to my .exe application. 

Thank you guys for your help.

0 Likes
Message 14 of 14

mahmoudabdelmoneam
Explorer
Explorer
Maybe something was missed along the way, good luck with your implementation.
0 Likes