delete a file locked by another process in C#
File.Delete(file);
not working gives error
i have to delete forcefully delete it
Delete a file locked by another process in C#
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Kapil Sharma125 reputationPosted Feb 25, 2016, 1:09 AM EST
VulpesRank #55 · 29.2K reputationPosted Jul 24, 2013, 2:17 AM EDT
As I said in the previous (deleted) thread, you will have to kill the other process to release the file handle.
You can either do this from the Task Manager, or you can use code similar to this:
using System.Diagnostics;
// ...
File.Delete should then work.