Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio PublishProfile to delete files?

I'm deploying my website to IIS, using msbuild (as mentioned by Scott Hanselman here) like this:

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

Which is mostly working fine to publish to my production server, or staging server, via TeamCity.

However, if some files have been removed from the project they are not deleted from the server. So some things that should be generating 404 errors are just picking up the old, out of date, files.

Is it possible to make deploying in this way also delete files that are no longer part of the web project?

like image 283
Wilka Avatar asked Jan 15 '23 04:01

Wilka


1 Answers

In the publish profile, on the Settings tab expand File Publish Options and select Remove Additional Files. Or for Web Deploy profiles you can pass in the value on the command line as /p:SkipExtraFilesOnServer=False

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

like image 149
tdykstra Avatar answered Feb 02 '23 09:02

tdykstra