Hi, I'm having some problems with DllImport and ASP.NET because when I use a imported method ASP.NET loads the Dll and locks the file even after it finished using it. Is there any way to force ASP.NET to release the lock on the file?
+1
A:
The only way to force a DLL out of the process in .Net is to unload the AppDomain in which the Dll is loaded. Unless you create a separate AppDomain in which run the DllImport code this will not be possible.
Also I know this policy applies to managed DLL's. I am not 100% sure if this applies to DLL's loaded via PINvoke but I am fairly certain.
JaredPar
2009-04-07 14:40:56
+1
A:
Only if you create a new AppDomain and load the dll into the domain. Afterwards you can unload the AppDomain and the dll will be unloaded.
Jakob Christensen
2009-04-07 14:42:09