Visual Studio 2015 can't open project.exe for writing. Access to path denied

亡梦爱人 提交于 2019-12-22 05:17:22

问题


I am developing a VB.NET (4.5 framework) solution in Visual Studio 2015, Win10 OS, and have been able to run the builds uninhibited for several months, but now I am receiving the following error upon starting the build:

vbc : error BC2012: can't open 'C:\MyProject\ProjR5\ProjR5\obj\Debug\ProjR5.exe' for writing: Access to the path 'C:\MyProj\ProjR5\ProjR5\obj\Debug\GenTagR5.exe' is denied.

At first, VS2015 would give me the option to run the last successful build, but even that is no longer an option. After exhaustive internet searches on this problem, none of the dozen or so given solutions are solving my issue.

Here is what I have tried in order to resolve the error so far:

  • Ran sfc /scannow (elevated prompt)
  • Using ProcessExplorer, find handle or DLL substring that included my project
  • Made sure there were no hanging procs (including procs with my project name, devenv.exe, [project].exe, [myproject].vhost.exe, etc.)
  • Restarted VS2015
  • Restarted VS2015, running "as Administrator"
  • Restarted Computer
  • Full Shutdown of computer
  • Complete Rebuild of Solution
  • Build->Clean Solution
  • Build->Clean Solution, then Build->Build Solution
  • Build->Rebuild Solution
  • Uninstalled and Reinstalled VS2015
  • Disabled all indexing
  • Removed "Read Only" attribute from entire project folder and files within
  • Checked startup scripts for like- or identical processes
  • Disabled all AV apps
  • Disabled all antispyware apps
  • Disabled all firewalls
  • Verified that Application Experience (services.msc) wasn't disabled (I'm using Win10 ... it isn't even in the list of services)
  • Set Tools->Options->Projects and Solutions->Build and Run->Max. parallel builds to 1
  • Rerun aspnet_regiis.exe (under .NET\Framework)
  • Checked Local Security Policies and verified account was listed under "Impersonate a client after authentication"
  • Removed \bin and \obj folders
  • Put \bin and \obj back when removing them didn't help
  • Removed \bin and \obj folders, then Rebuilt

None of these have worked. Any suggestions?


回答1:


The problem ended up being Samsung Magician's Rapid Mode losing data during its write-caching phase to my solid state drive. I turned off Rapid Mode, and now the project builds without any problems.




回答2:


New 2 programing in VS but i had same problem of Access or Write exe file ON BUILD. Problem came out of nowhere. I didn't use or make changes 2 exe file in months, made exe file, used it now and then and forgot about it.... Then after few months i wanted 2 start exe but no icon on desktop ??? ....tried everything, lost 3 days of searching inside code for error in VS and then called Google....

I read last comment ABOVE which mentioned Bitdefender, opened it and found BitD did block and isolate exe files ..... so i tried exluding files and folders which made problems inside BitD but no help....

So i went back 2 VS. Within debug i got some X86 processor error which didnt make problem to build but it was warning (free component name in error description helped me ), - errors you can ignore but they are here on build ....

So i made last move before starting it all over again. Removed COMPONENT from application, deleted it on PC ...started VS from start .. and ALL was OK !!!

So in my case it was all about FREE component i used in app inside VS .... Bitdefender found some add / virus in it and blocked build progress. BitD deleted or blocked exe file in start....

Hope this help anyone with similar problem !




回答3:


The cause of this error for me was that Team Foundation Server had pulled in a bunch of files to my work space as Read-only. Not sure why it pulled them down from the server with read-only checked, but all I had to do was uncheck it.




回答4:


Sorry for came too late, but i had this problem and i wanted to show how i fixed for the next devs who need a solution:

It's quite simple, just change your proyect assembly name:
1) On your solution explorer: Right click on your proyect.
2) Properties>> aplication>> assembly name>> change it.
3) Compile, run to test it.
4) Change the name again if u wanted the original name.

Adding a description: Changin the assembly name



来源:https://stackoverflow.com/questions/35353300/visual-studio-2015-cant-open-project-exe-for-writing-access-to-path-denied

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!