[英]System.UnauthorizedAccessException while deleting dll (C#)
Please read carefully: I know that dlls can be in use. 请仔细阅读:我知道可以使用dll。 I also know about NTFS permissions, and read-only flag.
我也知道NTFS权限和只读标志。
File.Delete(...)
method to delete it: I got System.UnauthorizedAccessException
File.Delete(...)
方法删除它:我得到了System.UnauthorizedAccessException
File.OpenWrite(...)
I got the same exception. File.OpenWrite(...)
打开它,但出现了同样的异常。 Using VS 2012 C# program (.NET 4.5) 使用VS 2012 C#程序(.NET 4.5)
Any ideas? 有任何想法吗? Thanks
谢谢
SOLVED: (partly): This was my firewall :-(. Somehow it cached and sandboxed my project output executable, and restricted to delete .dlls (not .txts). Although I turned off it, and I rebuild the .exe many times somehow the named exe sandboxed state remained active. I stress it was a many times rebuild and binary changed .exe. Congratulations to Commodo just 2 erratic behaviour in on issue. 1) Why the sandboxing is still active if antivirus has turned off? 求助:(部分):这是我的防火墙:-(。以某种方式将其缓存并沙箱化了我的项目输出可执行文件,并且限制为删除.dll(不是.txts)。尽管我将其关闭,但我还是多次重建.exe。不知何故,命名的exe沙盒状态仍然处于活动状态,我强调这是很多次重建和二进制更改的.exe。祝贺Commodo出现了2种不稳定的行为:1)如果关闭了防病毒功能,为什么沙盒仍然处于活动状态? 2) Why not reevaluate the named .exe file and asking me about sandboxing if the binary has changed?
2)为什么不重新评估命名的.exe文件并询问有关沙箱的问题,如果二进制文件已更改? How this is turned out?
结果如何? I renamed the project output to x.exe :-(
我将项目输出重命名为x.exe :-(
This was more the 45 minutes from my life and worktime... 距离我的工作和生活时间只有45分钟...
For delete try 对于删除尝试
File.SetAttributes(file, FileAttributes.Normal);
File.Delete(file);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.