tags:

views:

33

answers:

1

Hi, how do I delete an assembly file after application shutdown? This is not as easy as it sounds, because it is used in my default appdomain. For several reasons I cant simply create a new appdomain and put it there, but app domain solution is not really what I'm looking for anyway since this is complicated and I have a hard time juggling around with two of them already. I thought about creating a new process at shutdown which will delete the file I want to delete. But I would need to pass a string file path to that process somehow. In short: am I thinking too complicated? Is there a better solution?

I already tried deleting it after Dispatcher_ShutdownFinished was called, but it's still in use as it appears.

Thanks!

edit: sorry, I think there might be confusion: I mean that I want to delete a .dll file.

+1  A: 

Could marking the file for deletion upon next reboot work in your case? This article might be worth reading as well.

Darin Dimitrov
No, I need it deleted after app shutdown, not OS shutdown sadly.
Blub
the second article might do it, but is really not something I would call a simpler approach :)But it's pretty cool, so I might try it if noone has a better idea. Including me of course.
Blub
Oh no, I agree, it is not simple.
Darin Dimitrov