Visual Studio PublishProfile to delete files?

I am deploying my site to IIS using msbuild (as mentioned by Scott Hanselman here ) like this:

msbuild MySolution.sln /p:DeployOnBuild=true;PublishProfile=Production;Password=poo

      

It mostly works fine for publishing to my production server or staging server via TeamCity.

However, if some files have been removed from the project, they are not removed from the server. Therefore, some of the things that should generate 404 errors are simply collecting old, obsolete files.

Can I make it so that deploying this way also deletes files that are no longer part of the web project?

+3


source to share


1 answer


In the publishing profile, on the Options tab, expand Publishing Options and select Delete Additional Files . Or for web deployment profiles, you can pass the value on the command line as / p: SkipExtraFilesOnServer = False



For FTP profiles, the property is / p: DeleteExistingFiles = True

+7


source







All Articles