简体   繁体   English

C#File.Copy访问被拒绝错误

[英]C# File.Copy access denied error

I am trying to copy files from nunit test build folder to nunit runtime folder but getting 我正在尝试将文件从nunit测试构建文件夹复制到nunit运行时文件夹,但是

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. 我有一个文件夹路径设置,例如Testproject/bin/debug/something.config并尝试了以下选项,但对我不起作用。

  • Deleted the bin folder and then rebuilt it. 删除bin文件夹,然后重新构建它。
  • Opened closed VS. 开闭VS。
  • Deleted bin folder created new bin folder manually. 删除的bin文件夹会手动创建新的bin文件夹。
  • 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. 我也使用SVN作为源代码管理。

One thing that you haven't tried is to run Visual Studio as an administrator. 您没有尝试过的一件事就是以管理员身份运行Visual Studio。 Right click on it, and select run as administrator . 右键单击它,然后选择run as administrator

Sounds like it was locked and abandoned. 听起来像是被锁住了,被遗弃了。

I've used LockHunter to unlock files that Windows so often locks and abandons. 我使用LockHunter来解锁Windows经常锁定和放弃的文件。 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. 它还会告诉您哪些应用程序已锁定该文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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