How to use recompiled DLL?

I have an app that uses properties and function return values from certain
DLLs.  Each DLL returns the same thing but gets it in a different way.  An
abstract class is used to access the DLLs.

If I need to change code in one of the DLL methods, then recompile it, is
there a way to have the app use the recompiled DLL without shutting down?
What is the correct approach for this?

Thanks,
Brett

brettrAsked:
Who is Participating?
 
Jesse HouwingScrum Trainer | Microsoft MVP | ALM Ranger | ConsultantCommented:
0
 
brettrAuthor Commented:
I'm thinking simply destroy the object referencing the DLL.  The broken reference will cause GC on the object and should release the DLL(?).  Then I
can create a new object to reference the DLL and begin calling methods from it.  Will this work?  What happens is code executing inside the DLL?  Will
it finish then the DLL is release?
0
 
Jesse HouwingScrum Trainer | Microsoft MVP | ALM Ranger | ConsultantCommented:
In ordet to do this you will need to load the dll you want to dynamically re-load in a seperate app-domain. When you detect the dll has changed (through a filssystemlistener) you will have to destry teh app-domain in question, create a new appdomain and load the new dll in the new appdomain.
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
brettrAuthor Commented:
If I know when the DLL will be recompiled, can I just manually destroy/recreate it via a button click event rather than filesystemlistener?   The implementations would probably be the same, just different ways of doing it...right?
0
 
Jesse HouwingScrum Trainer | Microsoft MVP | ALM Ranger | ConsultantCommented:
That's right. The trick is in the extra applicationdomain, as you can only dynamically unload an appdomain, not a separate dll.
0
 
brettrAuthor Commented:
Ok.  Do you have any online references to app domains as they may relate to our discussion?
0
 
brettrAuthor Commented:
Yep - I had already printed that one out.  Thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.