Unable to copy file. Access to the path is denied

2019-01-14 20:43发布

问题:

I am working on asp.net 3.5 project on remote machine. I am accessing it using remote desktop. When I build the project, I get error:

Error   62  Unable to copy file "obj\Debug\myprojname.pdb" to "bin\myprojname.pdb". Access to the path 'bin\myprojname.pdb' is denied.

Project is under SVN. I deleted the obj\Debug\myprojname.pdb and tried to run again but getting same error. I am trying to remove thereadonly from the folder but after clicking ok, It becomes readonly again ( i guess because of SVN).

回答1:

I solved this problem by deleting the contentious files from bin folder and rebuilding the project.



回答2:

I solved it by Unchecking the Read-only CheckBox option on folder setting.



回答3:

I had the same issue and I only had to restart the visual studio. Classic move :)



回答4:

I started Visual studio as administrator and that worked.



回答5:

Removed read only flag on whole solution and it worked. Visual Studio 2012+TFS 2013



回答6:

I had this issue with WebActivator.dll

Closing VS and reopening resolved the issue for me



回答7:

If all else fails try a reboot of your computer - only thing that worked for me.



回答8:

Just found this, which worked for me:

Make sure bin isn't checked in to TFS.



回答9:

For me, my issue was that my AntiVirus had a handle on the referenced .dll that was used in my solution. Not exactly sure why, plan on researching it later. But killing my AV Service that had the handle, then restarting Visual Studio fixed this issue for me.

Hope this helps those of you who are maybe having to restart your entire PC when this happens, as before I figured this out, it was the only fix to my solution as well.



回答10:

I solved it by Unchecking the Read-only CheckBox option on folder setting.than reload the solution again :)



回答11:

Just remove the corresponding reference(.dll file) from the References and add it back again using add reference option.I got a similar error,and i have solved it this way.I hope it will help.



回答12:

After trying all the options below, the only solution was to restart the Windows 7.

  • Removed read only flag.
  • Restart the visual studio.
  • Remove the corresponding reference(.dll file) from the References and add it back
  • Make sure bin isn't checked in to TFS
  • Deleting the contentious files from bin folder


回答13:

I solved it by excluding my bin folder from my project in VS 2012. Right click on the BIN folder and select "Exclude From Project".



回答14:

If you only get this for select files:

  1. Go to Published file folder
  2. Select the problem Files
  3. Properties
  4. Uncheck Read-Only

Apparently this can occur when Source Control non-checked out files are read only, and then someone just copies specific files.

(I tried other people's suggestions: giving myself write access to wwwroot, running VS as admin, but for me it was the read-only that did the trick. I specify this answer to point out it is the files at the destination you are trying to publish to.)



回答15:

If you have done some check-in into the bin folder then this issue will come. Just delete that file and check-in again and build it. It will definitely work. Note: Please don't check-in anything into bin folder



回答16:

the error is pretty obvious there Access to the path 'bin\myprojname.pdb\' is denied. the user the web console process is running under (not the user you created in the webconsole, the actual windows user), most likely "Network Service" doesnt have permissions to that folder.

You can either - Right click on that folder, goto permissions and add the "Network Service" user - Right click on that folder, goto permissions and add the "Everyone" user

that should fix that problem.



回答17:

You might be opened two visual studios for two different solutions. Vs-A is in Debug mode and VsB is erroring out about .pdb file access denied. So remove the debug mode from Vs-A and Rebuild Vs-B. It should work now, without errors.

Good Luck.



回答18:

I resolved it by cleaning all projects individually and then rebuilding them individually in the order of their dependency over each other



标签: asp.net svn