I am using octopus deployment with teamcity. In many cases deployment fails because "The process cannot access the file or dll because it is being used by another process. How to write a script to fix this problem. Please guide.
I'm reading into your question a little here, but it sounds to me that you're trying to deploy a website and it's failing, because the IIS worker process is using the files - what you want to do is recycle the application pool of the website before you deploy, or, if it's a high traffic website, stop the website, do the deploy, then start the website.