Friday, July 27, 2012

Visual Studio build fails: unable to copy exe-file from obj\debug to bin\debug

My colleague fought this error for 2 days and finally found out what was causing this issue.


A little background is he was building a Console Application in Visual Studio to interact with SharePoint 2010.


He could rebuild this project many times over and work with it, debug it with no problems.


But, if he tried to run the .exe from windows explorer and then try to rebuild he would get the following error:
Error 4
Unable to copy file "obj\x64\Debug\Program.exe" to "bin\x64\Debug\Program.exe". 
Access to the path 'bin\x64\Debug\Program.exe' is denied.


After many failed attempts to narrow down the issue and trying many different solutions without avail finally he found a working solution.


It all has to do with a tiny little Windows Service called Application Experience.
The description of this service helps you understand why this service is important to what our issue is:
Processes application compatibility cache requests for applications as they are launched
Make its Startup Type Automatic and Start this service and you should be good to go.

No comments:

Post a Comment