.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

What to do with referenced DLL files?

4 REPLIES 4
Reply
Message 1 of 5
drauckman
631 Views, 4 Replies

What to do with referenced DLL files?

I am trying to debug a project and I have started to use a few different third party libraries.  This causes a huge headache since when I netload the DLL with the command method defined in it, nothing will run since I get errors stating that I am missing a reference.

 

For example: I create a library that is used to process text strings from a drawing (no AutoCAD .NET, just takes text in) and create a report based on this text and create a class library DLL of this.  I now create a AutoCAD .NET class library with a command method and in this command method I loop through blocks and send the attribute text to class library.  In order to do this I add a reference to my previous project DLL file and add a using directive.  By default CopyLocal is set to true so I hit build and it is successful (now my class library DLL and AutoCAD .NET library DLL are in the same debug folder).  Now I go into AutoCAD and NETLOAD the command method DLL from the debug folder and I am unable to run it since AutoCAD will complain about that referenced class library DLL that I created in the first step.

   

 

The only way that I can get my command to run is if I manually NETLOAD each dependant DLL that I have added to the project.  How can I avoid this?  I am at the point where my project is getting complex and NETLOADing 20 DLL's just to debug is getting painfull.

 

I have read someplace that I would have to add all of my referenced DLL's to the AutoCAD folder, but this seems messy and hard to control (what if somoene else is using the same library but a different version?)

 

Why is it that my code has references defined, and using statements to say I am using these libraries but AutoCAD refuses to locate these references?

 

Is there a simple way to get around this without copying files all over the place?  The third party libraries are either in the debug folder from copying manually, or copy local is set to true.  I do not understand why when you tell AutoCAD to load a DLL from a folder that it would not try to resolve dependencies from the folder you pointed it to.

 

 

Just to clarify my question is: Is there a simple way for AutoCAD to resolve referenced third party / custom DLL's that are included with an add-in?  And this question is for development and not an installer.  I want to hammer out a test solution and test quickly without copying files all over or editing the registry.

 

 

4 REPLIES 4
Message 2 of 5
dgorsman
in reply to: drauckman

Keeping DLL files in the AutoCAD executeable folder isn't a requirement, AFAIK.  It just guarantees AutoCAD can find them easily.  I keep mine in a completely separate folder for just the reasons you noted.

 

For debugging purposes, I'm not sure what to do, aside from creating a temporary bootstrap to load those DLLs on  the fly.  But then, what are you planning to do on users workstations to get everything loaded?

----------------------------------
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.


Message 3 of 5
drauckman
in reply to: dgorsman

I have found similar questions on here but it sounds like for others if they have references and they are copied to the debug folder that when the NETLOAD the main DLL with all the references that AutoCAD will find them and they do not get any errors like I do.  Am I missing something because even if I have all the files in one folder I still need to manually NETLOAD each one before it will work. 

 

Does it become a problem when you have a referenced assembly referencing another assembly even though they are in the same folder?

 


@dgorsman wrote:

 

For debugging purposes, I'm not sure what to do, aside from creating a temporary bootstrap to load those DLLs on  the fly. 


 

What do you do to create this temporary bootstrap?  I have never run into having to do this.

 

Is there any alternatives like adding the folder to AutoCAD's settings?

 

With the new bundle package when I release the software it looks like I can point to all of the assemblies that are needed for my project in the XML, so this should not be a problem??

 

I am just having a hard time understanding why when I rub AutoCADs nose in the pile of files that are in the folder with the DLL I netload that it does not think when looking for an assembly that maybe it would be in location I just explicitly showed it.

Message 4 of 5
arcticad
in reply to: drauckman

You can make a lisp file with each of the dll files you want to load

 (command "netload" "C:\\myDll.dll")

then use appload to load the .lsp file.

 

Also have you tried adding the path to windows.

http://www.computerhope.com/issues/ch000549.htm
(I haven't tested this idea)

 

or add the folder the autoCAD's search path in the options menu.

(again not tested)

 

---------------------------



(defun botsbuildbots() (botsbuildbots))
Message 5 of 5
drauckman
in reply to: arcticad

I am not too sure what happened but now when I try to run my project I load only the autocad plugin DLL and all the references resolve and I do not get any error messages. 

 

The only thing that I did was clean the solution and then build all so maybe that had something to do with it?  I swear I did this a few times in the past when I was trying to figure this out and it did not have an effect.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost