Visual Studio solution won't compile but project

When I build or rebuild my solution, I get the error:

Error CS2012 Cannot open 'C: \ Users \ myUserName \ Documents \ Visual Studio 2017 \ Projects \ mySolutionFolder \ myProjectFolder \ obj \ Debug \ myExecutable.exe' for writing - 'Path access' C: \ Users \ myUserName \ Documents \ Visual Studio 2017 \ Projects \ mySolutionFolder \ myProjectFolder \ obj \ Debug \ myExecutable.exe 'is denied.'

However, when I build the project, it compiles fine. As soon as I build the project, then the build of the solutions throws no errors. I am running Visual Studio 2017.

What I have tried (no success):

  • There is a second draft in the solution, but I unloaded it and still have errors.
  • I deleted the solution file and created visual studio new.

Additional information: The error is somewhat random. Usually he is wrong, but sometimes he is not. The chances of an error decrease longer than I wait between "Clean" and recovery. I have the same problem even when running in admin mode. I am starting to think that this is a hard drive problem.

+3


source to share


1 answer


The app is still running.

\ Debug \ myExecutable.exe 'is denied.' tells you that you cannot replace this because it is currently open.

Open Task Manager and make sure you complete this process and it should work fine after that.



This usually happens to me when I receive this error.

Hope it helps

+2


source







All Articles