Error BC2012 Can't Open for writing: Access to the path is denied.


  • Running VS2015 with Win10, .NET Framework 4.5, project is in VB. Was able to run project approximately 2,000 times before the error started occurring:
    "vbc : error BC2012: can't open 'C:\MyProject\ProjR5\ProjR5\obj\Debug\ProjR5.exe' for writing: Access to the path 'C:\MyProject\ProjR5\ProjR5\obj\Debug\ProjR5.exe' is denied."

    I have checked the path, the the ProjR5.exe doesn't even exist, yet upon starting the build, VS is looking for it, however, based on the error semantics, the issue isn't the missing file, but the denial of access to anything in the path ... or is it?

    I have spent a greater portion of three days scouring the web for a solution to the problem, to no avail. Here is what I have tried to alleviate this problem ... Have I missed something?

    • 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
    • Complete Reentry of all code from scratch
    • Removed all references
    • Re-added all references
    • 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
    • Checked startup scripts for like- or identical processes
    • Disabled all antivirus apps
    • Disabled all antispyware apps
    • Disabled all firewalls
    • Verified Application Experience (in services.msc) wasn't disabled (I'm using Win10 ... it isn't 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 altogether
    • Put \bin and \obj back when removing didn't help

    I'm sure I've overlooked something right in front of my nose. Any ideas?

    Friday, February 12, 2016 12:39 AM


All replies