views:

262

answers:

4

Is there a way that I can make VS 2008 always kill the w3wp process before building a project? I feel like it used to do this on my machine, but now I always have to kill it manually before kicking off a build or else it will fail to deploy the new binaries to my localhost.

EDIT:

If I don't manually kill the process before kicking off a build in VS 2008, I get this error message:

Error 1: Unable to copy file "UPDATED_DLL_I_JUST_BUILT" to "DLL_CURRENTLY_ON_SERVER". The process cannot access the file "DLL_CURRENTLY_ON_SERVER" because it is being used by another process.

+1  A: 

Which w3wp.exe process? There may be more than one of them.

You could create a pre-build script to do this, assuming you have access to do this. If multiple developers are building this project, or if you're running automated builds, then you'll want to make sure this works (and is desired) in those cases.

John Saunders
A: 

You can add a pre-build event to kill the process if you want to. You add these in your project's property sheet.

As a side question, why do you want/need to kill w3wp.exe on each build?

Andrew Hare
+1  A: 

You could so an iisreset as part of a prebiuld step for your web project.

JP Alioto
+1  A: 

As others have said, add a prebuild event. Here is a command:

taskkill /F /IM w3wp.exe

(As pointed out in the comments, this will not work on Windows XP Home)

Lucas Jones
not one home editions of windows... though I don't think this is a problem for most.
jle
Is taskkill not there? Well, you learn something new every day :-).
Lucas Jones
You do mean XP Home or is it Vista too?
Lucas Jones