Debug in Visual Studio 2017 gives access denied

Viewed 14667

I have installed Visual Studio on Windows server 2012 and now I'm trying to debug an existing project. This gives me 'Error while trying to run project - access denied' I have now problems running the project without debugging.

I have restarted Studio and no files are read-only

5 Answers

Access Denied errors can occur if a file has an unresolved lock on it. This can happen whether or not your file, typically the executable that you just compiled, is read-only or not.

The easiest way to clear a lock like that is to reboot your system. Or if you're unwilling to reboot or you just want to make one file available again, you could use a tool such as Process Explorer to find the process that is using the file, and either close the program or kill that process.

What fixed it for me (Running VS2019 + Win10) was adding my source folder to the exclusion from Windows Defender Threat Protection.

Found the solution was to DISABLE 'use managed compatibility mode' in the debugging>general section of VS2019 options.

Windows Registry Editor

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System]
"EnableLinkedConnections"=dword:00000001

This will solve the problem

Related