I had a small WPF application that I was developing and every time I would stop it, make a quick small change then restart it would wait for a file lock then fail.
error message is :
error LNK1168: cannot open [Yourfile].exe for writing
i.e. Visual Studio said it couldn’t open the file for writing. I just got used to waiting for about 30-60 seconds each iteration hoping the lock would go away. It was always the system that had the file handle.
Well, it seems that the issue was related to the fact I disabled the Application Experience service.
How random, right? Well, reenabling it has stopped the issue, for now.