Link to home
Start Free TrialLog in
Avatar of acousticsatelite
acousticsatelite

asked on

Replace DLL while application is running

Is it possible to update a DLL while a service is running that uses the DLL ? Or does the service have to be stopped before the DLL can be replaced.
ASKER CERTIFIED SOLUTION
Avatar of athapa
athapa

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
you can change the dll while the app is runing only if you load the dll at runtime into a different appdomain.

appDomain = AppDomain.CreateDomain("MyNewDomain");
assembly = appDomain.Load("dllToLoadDyn");
SomeType = assembly.GetType( "dllToLoadDyn.SomeType" );

// do whatever with the dll

AppDomain.Unload( appDomain );

hth,
A.