Access error while trying to create a console application VS2010 (could not write to the output file)

VS2010 running on Windows7x64

I am trying to create a console application VS2010 and sporadically get this error:

Could not write to output file 
'D:\somepath\someProjectName\obj\Debug\ProjectName.exe' -- 'Access is denied. ' 

Using the Sysinternals ProcessExplorer, I can see the handle of this file, but when I click on it, no application shows it, and when I try to close the handle, I get the "error opening process: the handle is invalid." Error in ProcessExplorer.

If I go to a folder in Windows Explorer, I can physically delete the file (it seems so), but the lock still persists, making me think that it may not have been deleted at all, maybe it is just waiting to be deleted?

Is this a known mistake, something I'm doing wrong, something else?
Is there a utility that can make this file unlock?

See here for possible solutions:
Visual Studio build error: unable to copy exe file from obj \ debug to bin \ debug

+3
source share
6 answers

I had the same problem, and it was AVG Resident Shield for me that scanned files as they were copied, opened, or saved. After turning it off temporarily, my problem disappeared.

+4
source

I have the same problem when I was building an installation project and VS was not able to delete the previously created .msi

I deleted it myself and tried to create the installation project again, and it worked.

+2
source

Team Foundation Server, Visual Studio TFS Cache (, C:\Users\\[login]\AppData\Local\Microsoft\Team Foundation\[version]\Cache).

Visual Studio , TFS.

+1

, , .exe , , . , .

0

I copied the solution parent folder to another location on the computer. After that, I rebuild the project and it works for me.

0
source

I had the same problem.

This happened after I installed AVG antivirus. Just unplug or uninstall AVG and the problem goes away.

This can help remove or replace the te folder where your assembly is located, and then rebuild the project.

Hope this helps!

0
source

Source: https://habr.com/ru/post/1792106/


All Articles