windows - delete a file using a child process in .net -
My app uses a file and tries to delete it after using it, however, a third party libraries Due to this, my app can not release the file handle of this file, so can not delete the file, because the file itself is used by the process itself to start process.start () to start a different process Tried, whose work only ul The written file is to be deleted. I am using Net 4.0. However, it seems that the new process has inherited the file handle and can not delete the file.
Any suggestions?
Will a separate process be able to delete a file which can not delete your own process? It's not how it works. If this is the case then you can just bypass the limitations of usage by starting a new process.
You must close the handle to delete the file. If the library can not be made to shut down correctly, in which you can start a hair process that includes all library functions. After you finish your work, you get out of the child. The handle is closed as part of the cleaning process.
Comments
Post a Comment