Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 569
G. Holland Avatar asked Feb 12 '16 01:02

G. Holland


2 Answers

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.

like image 174
G. Holland Avatar answered Oct 20 '22 03:10

G. Holland


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

like image 1
Beli Mon Avatar answered Oct 20 '22 02:10

Beli Mon