Reputation: 13434
How can I write to a file which is used by another process in C#?
I am able to read the file using FileShare.ReadWrite
, but it only works for FileAccess.Read
. Does anyone have a solution?
Upvotes: 0
Views: 145
Reputation: 143
You should read the file contents to a separate Stream and then the file is released.
Upvotes: 0
Reputation: 3931
If the other process has write-locked the file, then there's not much you can do, unless you don't mind closing the other process's handle or killing it.
Upvotes: 4