sam
sam

Reputation: 4684

How to delete files prior to publish using msdeploy or msbuild?

I am using msdeploy to publish on a remote server via teamcity. Problem is msdeploy doesn't delete files in IIS site directory prior to publish. Can any one tell how to delete file prior to publish using msdeploy or do I have to write a batch script to delete directory and then recreate it?

Upvotes: 2

Views: 4295

Answers (2)

Andrey Ravkov
Andrey Ravkov

Reputation: 1484

For delete files in a folder, but don't delete folder i find a solution with sync functionality. I synced an empty folder with destination folder.

my command is:

msdeploy.exe -verb:sync -source:contentPath="path to empty folder here" -dest:contentPath="folder to cleanup",computerName=%msdeploy_Server_Url_here%?site=%IIS_Site_Name_here%,userName=%msdeploy_user_name_here%,password=%msdeploy_user_pwd_here%,authType=basic -allowUntrusted=true

Upvotes: 1

Mark van Straten
Mark van Straten

Reputation: 9425

see http://technet.microsoft.com/en-us/library/dd568992(WS.10).aspx for extra msdeploy rules which you can enable/disable. I think you need the 'DoNotDeleteRule' but i am not sure.

Upvotes: 1

Related Questions