Rebuilding the dll file

Rebuilding the dll file

J-Rocks
Collaborator Collaborator
3,638 Views
7 Replies
Message 1 of 8

Rebuilding the dll file

J-Rocks
Collaborator
Collaborator

hello ,

 

I have built a program to draw a line through Visual Studio 2013 and opened Autocad and call the command netload to run the program and everything is okay till now , but I modified the program and wanted to reload the same .dll file .

 

I tried to rebuild the program from menu BUILD -> Build addLine  but that did not work .

 

Should I evertime I modify the program EXIT Autocad and DELETE the .dll file and re-create a new .dll file to have the new modifications working ?

 

Any help is greatly appreciated .

 

John

0 Likes
Accepted solutions (1)
3,639 Views
7 Replies
Replies (7)
Message 2 of 8

dgorsman
Consultant
Consultant

You can't reload or unload managed dotNET DLLs into AutoCAD.  If you want to update one, the program must be closed first.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


0 Likes
Message 3 of 8

J-Rocks
Collaborator
Collaborator

Thank you for your reply .

 

maybe I wasn't clear enough or I did not get your point. Let me try again .

 

I loaded my dll file into Autocad and that is fine till now , but I modified my program and added a few line of codes to change color and lineweight , then I reloaded the same dll file and it is still working as it was from the first load .

 

Is it due to the dll file that it is not being updated with the new changes that I added to the program ?

 

I had to to exit AutoCAD then delete the dll file and rebuild a new one then load it into autoCAD and it is running just fine with the new changes to the program , so this is the process that I am trying to avoid .

 

Many thanks

0 Likes
Message 4 of 8

hgasty1001
Advisor
Advisor

Hi,

 

You can't unload a managed dll, there are some tricks/hacks out there, but in my opinion just don't deserve the cons. The usual debugging process is like that you mention, but you can activate edit & continue to made changes while debugging. If you have the proper project setup in VS, F5 should start AutoCAD, and stopping the debugger should close AutoCAD for you.

 

Gaston Nunez

Message 5 of 8

J-Rocks
Collaborator
Collaborator

I am sorry , I am talking about something else .

 

Fo example : I have wrote a program to draw a circle and I used BUILD command to have the .dll file format , I loaded the proram and everything is great till now .

 

Now I need to modify the proram to change the color of the circle to red , so I opend my source program in VB.net and added the required codes to the program , NOW I need to make the .dll file to be able to load in AUtocad to use it so I am trying to use the BUILD command but it fails and the command REBUILD and it also failed so the only solution that I doing now and it is really bothering is to delete the old .dll file and exit Autocad to be able to produce the new .dll file .

 

Hope this clear and I am ready to explain in needed details it needed .

 

Many thanks.

 

John

0 Likes
Message 6 of 8

norman.yuan
Mentor
Mentor
Accepted solution

You do not need to manually delete the DLL files. You simply close AuotCAD. Then when you build the DLL with VS again, the DLLs will be overritten.

 

The reason your rebuild fails because the DLLs the building process is to overwrite are loaded into AutoCAd and Windows flags the DLL files as "in use" and cannot be deleted. As the other reply pointed out, the .NET DLLs loaded into AutoCAD cannot be unloaded from AutoCAD, so you must close AutoCAD before the DLLs can be replaced by the re-building. But you do not need to manually to delete it.

Norman Yuan

Drive CAD With Code

EESignature

Message 7 of 8

J-Rocks
Collaborator
Collaborator

Thank you norman.yuan , your solution works  great .

 

Thanks to the other guys whom trying to help me with this problem .

 

Kind regard .

0 Likes
Message 8 of 8

lomaka360
Explorer
Explorer

Probably too late but
There is a thing called AddInManager, it allows you to rebuild project without shutting down the CAD. I was walking through similar questions all day, but no one tells about it.
Hope it will help
https://github.com/chuongmep/CadAddInManager

0 Likes