开发者

error in visual studio, Access to the path is denied

I've been having this problem for a while now. I created a brand new winforms c# application in Visual Studio. I can usually launch it in debug mode once without a problem. However, if I close it and launch it again I get an error "Unable to copy file TestApplication.exe to bin\release\TestApplication.exe". Access to the path is denied.

This is driving me crazy. Why is this happening? I noticed that the folders are marked as read only. However, when I try to change it nothing happens. My manager suggested that it could be the fault of some of the extensions that I've installe开发者_高级运维d. I'm using Microsoft's power tools as well as AnkhSVN plug in.


First check to see if you can delete the EXE. If you can't that means some process has a handle on it.

Run Process Explorer and do a search for TestApplication.exe to find what it is


Have you tried enable windows service 'Application Experience'? This solved my problem after struggling for several days.

http://www.codeproject.com/Questions/296249/Visual-Studio-2010-Access-Denied-Errors


Do you have your bin folder included in your svn? In general, you shouldn't do this, for exacly this reason.

These folders - bin and obj - are generated by VS, and so shoudl be regenerated if you check out the code again.


I had this problem today.

Symptom:

  • Build error for nearly all projects in my Visual Studio solution (IntermediateOutputPath errors with paths to temporary files)
  • Auto-inserted IntermediateOutputPath entries in all *.csproj files
  • No access to all bin\Debug and bin\Release directories (it sayed administrator rights are needed, but even with admin rights no access was possible)
  • File system check by chdsdk reported no errors

When removing these entries from the project files (by the undo function of the version control system), they were auto-inserted again after a few seconds. Really strange!

Solution:

  • Windows restart
  • Remove auto-inserted IntermediateOutputPath entries from *.csproj files

Then the problem was solved on my system. I hope this helps other people to avoid waste of time. Just try a restart and before hunting a phantom error. Good luck (-:


You can Run a program called Unlocker.exe which is a small program which unlocks the locked program.

Try to unlock the exe which is locked and it will give you the exact program which is locking it.

This will help you pin point the problem.


Have you tried running VS as an administrator? I've run into this problem recently and searched online to see if anyone has found an answer to it. The only thing I do that works is run as an administrator, but I hate having to do that.

[edit] I just read a subsequent comment by someone else about turning on Application Experience in services. That seems to have fixed it for me. I've been running on Windows client for years and just recently switched to Windows Server, which explains why I hadn't run into it before.


I added a web service/reference to my Web Server and then my Visual Studio went all crazy and wouldnt recoginze and custom controls or web services. The pages worked for the end users.. Just had access / recognition issues in VS.

I saw a few posts to remove cache files in C:\Users\gklein\AppData\Roaming\Microsoft\VisualStudio\10.0\ReflectedSchemas - I did that but it didnt work for me...

What did work was when i recompiled the web server, there was an error about access to C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\remedy\7642007a\c5be7720\App_WebReference file/folder...

My web server runs impersonating a global network user with elevated access rights...But they recently migrated my pc to a new domain where that user has no rights. The web site couldnt compile (as that user) on my pc. - Once I manually added that global network user as an admin on my pc... cleared cache and restarted VS.. IT WORKED!!!

hope my experience helps some else tooo


I recently had this issue. I manually deleted and replaced the file and continued to have the access error. I restarted my laptop and I was able to build and run my project.


An XML file generated by my solution had the Read-only attribute set for a file version generated by another build. After the Read-only attribute was turned off for this file, my build ran without the path is denied error.


Had this problem on Windows 10 and it was coming from Windows Defender Antivirus.

I excluded the folder containing the .exe file and it worked again.

You can do that in Windows Security > Virus & threat protection settings > Exclusions


I had the same problem, by running VS2019 as administrator solved the issue.


Symantec Endpoint Protection caused this on my pc. It had quarantined the output folder (set it to readonly), believing it was infected.


Running Visual Studio as administrator is the only way I can solve this problem. That works on my windows 10 laptop, running visual studio 2019 community (version 16.8.3 ).

Note that even though I have changed the properties settings of the VS app by ticking the box "run as administrator" under the properties -> advanced console, I still have to manually select run-as-administrator every time. VS still will NOT run as administrator automatically.

I have previously tried adjusting the windows 10 read/write permissions for every folder and file within the VS solution - that did NOT fix the problem.


The bin folder in my project was read only. Right clicked the bin folder and under properties unchecked the "Read-only" and chose sub folders in the next popup. This resolved the issue for me.

error in visual studio, Access to the path is denied


I've had this problem (access to bin folder when debugging) from time to time and usually it's been sufficient to kill the VS process and start over. Today I encountered something odd: In a new TestApplication I was in need for some random numbers, and happily typed the line Random rnd= new Random(); The problem occurred immediately and the only way to get rid of it was by commenting this line. When uncommenting Random rnd = new Random() problem returned.


I've been experiencing this problem now for the last 9 months, in VS2015 and VS2017 community editions. It appears that the compiler continues to live after the first compile for about 20 minutes, all the while holding locks on the files.

My workaround is to kill the compiler, then rebuild. This always works without any apparent adverse side effects.

You can kill the compiler from the Package Manager Console (or from PowerShell) with this code:

Get-Process | where {$_.ProcessName -eq "VBCSCompiler"}  | foreach {Stop-Process -Id  $_.Id}

Hope this helps you as it has me for the past couple of months.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜