Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've set up a Visual Studio publish button for my application, including the "remove all files before publishing" setting. It looks like it's not succeeding in removing the files, though (possibly they're still locked, maybe IIS is still serving them?). Sometimes I discover left over, older, files in my testing, and have to remove the by hand.

My current workaround is to delete the site manually, and then do a publish. That kind of sucks, though. I'd like to be able to do a publish in a single click.

Is there a way to set this up? To make sure that all of the files in the directory are removed before publishing a new version of the application?

share|improve this question

I've never run into that problem, but if you stop the application pool that the app is running prior to redeployment then that should ensure IIS is not locking the files.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.