简体   繁体   中英

C# File.Copy access denied error

I am trying to copy files from nunit test build folder to nunit runtime folder but getting

Access denied error

I have a folder path setup like Testproject/bin/debug/something.config and tried the options below but its not working for me.

  • Deleted the bin folder and then rebuilt it.
  • Opened closed VS.
  • Deleted bin folder created new bin folder manually.
  • Tried to remove readonly in folder option but it again gets set to readonly.

I found these worked for others in the thread Unable to copy file. Access to the path is denied

I am also using SVN as source control.

One thing that you haven't tried is to run Visual Studio as an administrator. Right click on it, and select run as administrator .

Sounds like it was locked and abandoned.

I've used LockHunter to unlock files that Windows so often locks and abandons. Even after rebooting the files can sometimes remain locked by a process that no longer exists.

It will also tell you what applications have locked the file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM