Hi,
I'm creating a dll at run time and after using that dll finally I'm trying to delete that dll at run time but I'm getting UnAuthorizedAccessException .
File.Delete(location).
But once after the application is closed and if I try to delete that file while the application is loaded then that dll is getting deleted at run time only.
Can anyone please tell the solution.
Regards,
Ramana
Loading
VulpesPosted May 24, 2011, 4:49 AM
Sam HobbsPosted May 24, 2011, 12:22 AM
If what you mean by "using that dll" means you are using LoadLibrary (or are using something that results in using LoadLibrary) then ensure that there is a FreeLibrary corresponding with every LoadLibrary.
If you are trying to delete the DLL file in the same program and the same execution of that program then be sure to Dispose of the object used to create the file after the file is created, but in my experience that might not be enough.