1

I am using VS2012, every time I build a program the exe file is locked for about 5 minutes. I can't manually delete the file or rename it. I am running Windows 7 64bit with no antivirus software. This never happened with VS2010, it only started happening when I upgraded to VS2012. Has anybody else experienced this? Is this a bug in VS, or is something wrong in my setup?

Benjy Kessler
  • 7,356
  • 6
  • 41
  • 69
  • Maybe the build isn't actually complete for a few minutes, and VS2012 is still accessing the .exe during that time. Is this a really large app? – Joe M Feb 20 '13 at 21:45
  • No it's a tiny app, I can run it, debug it etc. just not delete it for 5 minutes after the build. – Benjy Kessler Feb 20 '13 at 21:46

2 Answers2

2

I've experienced this when I don't terminate my threads properly both in 2010 and 2012. After a test-run, I change something and try to build.

The short term fix for me has been to kill the relevant process (not VS, but the host process for your EXE). The long term fix to hunt down where I forgot to terminate your threads properly.

But this question/answer may be more relevant for you: Visual Studio locks output file on build

Community
  • 1
  • 1
  • Are you saying that when you stop running the program in VS, it still exists in task manager and you kill it from there? My program is not multithreaded, should this still happen? – Benjy Kessler Feb 20 '13 at 21:49
  • By the way closing VS doesn't help, it's still remains locked for 5 minutes. – Benjy Kessler Feb 20 '13 at 21:50
  • I *think* I've only encountered it in my multithreaded programs. But if you run it from within VS, you should still see a .vshost.exe in the Processes-tab in your Task Manager. –  Feb 20 '13 at 21:51
  • Once I stop running the app from VS it no longer appears in the task manager. – Benjy Kessler Feb 20 '13 at 21:52
  • On my box it disappears from the Applications list, but remains in the Processes for a while. –  Feb 20 '13 at 21:53
1

What solved this issue for me was enabling the Application Experience service. Here is a description of what the service does. Here is a thread from Microsoft which discusses the problem.

Benjy Kessler
  • 7,356
  • 6
  • 41
  • 69