2

Everytime i build my C++ project, visual studio keeps exe file open for about 2 mins. I dont even run the exe file just build it. 2 mins i m forced to wait to build it again.

Exe handle is owned by SYSTEM process. Because of that i cant delete, move, rename etc.. by hand or with pre-build commands.

There are no antivirus programs, index service or any other process running.

problem is related to size of my project. issue does not reoccur in small sized project.

Do you know any workarounds ?

MPelletier
  • 16,256
  • 15
  • 86
  • 137
mikbal
  • 1,168
  • 1
  • 16
  • 27
  • I've noticed much less severe delays in my projects. I assumed it was the linker finishing up from the previous build. – Mordachai Nov 19 '11 at 17:39
  • Looks like probably the same issue as this: [Visual Studio build fails: unable to copy exe-file from obj\debug to bin\debug](http://stackoverflow.com/questions/2895898/visual-studio-build-fails-unable-to-copy-exe-file-from-obj-debug-to-bin-debug) – bobbymcr Nov 19 '11 at 17:42
  • Are all files onn your local machine, or are some of them possibly on a remote file server? – RED SOFT ADAIR Nov 19 '11 at 17:43
  • bobbymrc3 prebuild events does not work. system owns the handle and does not allow file to be moved or removed – mikbal Nov 19 '11 at 17:47
  • @mikbal Sorry to ask but what are the system specs? – FailedDev Nov 19 '11 at 17:53

2 Answers2

0

Well, one hack to cut the wait time in half is to alternate between release and debug each time.

JRL
  • 76,767
  • 18
  • 98
  • 146
0

I rename the exe. Add a pre-build that renames (not deletes, but renames) the old exe (if it exists).

It was the only thing that worked for me, because sometimes it wouldn't be "minutes" of file in use, but hours; and the only thing that would fix it would be to restart VS2010.

Mahmoud Al-Qudsi
  • 28,357
  • 12
  • 85
  • 125
  • closing visual studio is a good idea. i just wrote a macro for the job, just press key and restart automatically. not need to wait now. – mikbal Nov 19 '11 at 18:51
  • don't you then trigger a full link? seems like you'd lose the time savings of incremental linking if you rename the exe each time before building. – Nerdtron Nov 20 '11 at 13:51
  • @Nerdtron Yes, absolutely. But you lose more time restarting Visual Studio than you do relinking :) – Mahmoud Al-Qudsi Nov 21 '11 at 19:15
  • @MahmoudAl-Qudsi I'm not sure, with a large project a full link can take a loooong time! There are times I would have MUCH preferred the time it took to restarting studio than to wait through a full link :) – Nerdtron Nov 21 '11 at 20:08
  • @Nerdtron I've worked on C++ solutions with over 40 projects being linked together (100 of millions of LoC) and if you only delete the main EXE, it really shouldn't take that long. I'd revise my linker settings, honestly - you shouldn't be linking everything if the main exe vanishes. – Mahmoud Al-Qudsi Nov 22 '11 at 10:17
  • @MahmoudAl-Qudsi the slow times I've seen have just been in creating the .exe. The final linking stage where it builds the .exe for some reason can take a very long time when it does a full link. An incremental link isn't bad at all, but when it does a full link you really have to sit around waiting. I'm guessing its not about the # projects, rather the # source files in a given project. – Nerdtron Nov 22 '11 at 12:16