Click here to Skip to main content
15,891,473 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have been using NLog in a WPF application for some months. I am developing in Visual Studio 2015 on Windows 10.

I write from my application using NLog into \bin\Debug\Logs. Suddenly I find I do not have permission to delete log files in this directory. And this obviously propagates up the directory tree, so I cannot delete the \bin folder in Explorer.

I do run Visual Studio as Administrator. I switched to doing this to fix a problem I had ages ago (can't remember what the specific issue was), but it has never stopped me deleting NLog files before now.

I did get a Windows Update a few days ago. Does anyone know if there has been a change that might be causing this behaviour?

I would also appreciate any suggestions about how to fix this.

What I have tried:

Even attempting to do this in a command prompt with Administrator permission fails with 'Access is denied'.

I cannot take ownership of the file either. If I try to do this in Explorer, I get a message saying, 'You must have Read permissions to view the properties of this object.'
Posted
Updated 13-Jun-17 23:34pm

1 solution

This turned out to be the Gamut File Viewer (www.gamutsoftware.com), which I have just started using (that should have been my clue). Reading the docs, it seems it has the functionality to clear the log file, which probably means it keeps a permanent lock on the file.

I am surprised that I was even denied Read permission though.

I was going to delete this question, but then I thought it might have value to anyone else who chooses to use this fairly common set of tools.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900