The question has been asked many times without an answer for me. This version is with a C# .NET CONSOLE application and happens with the default C# program.
namespace ConsoleApp6
{
class Program
{
static void Main(string[] args)
{
}
}
}
From Visual Studio Community 2017 - Create a new C# Console Application with all the defaults and build either the Release or Debug config. If you run it from within the VS environment, or even from the command prompt after completion the .exe will remain locked and owned by 'System' w/PID of 4.
Attempt to rebuild it. - the .exe is locked and can't be overwritten producing the retry count error.
How to create the default console app: File -> New Project -> Templates -> Visual C# -> Windows Classic Desktop -> Console App (.NET Framework) [The .NET version doesn't seem to matter]
Using process explorer to search for the file name shows that it is being access by system w/PID of 4. Lockhunter suggests a reboot.
Sometimes closing VS releases it. I've also tried using x86 in debug and x64 in release - in one case the .exe was unlocked. Unchecking debug/trace made little / no difference. Deleting the .pdb doesn't seem to matter.
In this simple example, after a minute or so the .exe may be unlocked from system PID 4, but in my actual project it takes 15 mins. I'm using 5 build configs to avoid the problem - (I'm attempting to interface w/hardware-software that is poorly documented.)
I'm running Win 7 Pro Sp 1 x64, with Win Defender stopped and anti-virus UN-installed. Experiments where done after a clean reboot before starting other applications - although Vmware service, OnTime RTOS service, and many other application services are running.