Unloading an Assembly loaded via reflection.
-
I've loaded an assembly by reflection, and now wish to re-combile the resource it represents, before continuing my testing of it. The problem i have is, once i load an assembly, it remains in use until i exit my application. I've closed all refferences to this assembly, and all types used by it have been disposed and garbage collected. How would i go about unloading the assmebly completely from my application? Cheers Tris
-
I've loaded an assembly by reflection, and now wish to re-combile the resource it represents, before continuing my testing of it. The problem i have is, once i load an assembly, it remains in use until i exit my application. I've closed all refferences to this assembly, and all types used by it have been disposed and garbage collected. How would i go about unloading the assmebly completely from my application? Cheers Tris
Unloading of single assemblies is not possible. You can unload only at the AppDomain level, so a solution in your case could be loading your assembly in a separate appdomain and then unload it when it is no longer used. For a better explanation on the reasons why you cannot unload single assemblies and alternative ways of doing it i suggest you this Bye!