When I build and deploy using Visual Studio, I can choose to 'remove additional files at destination'.
How can I do this with MSBuild? As the additional files will vary, I can't just use the Remove and RemoveDir tasks.
If you have a publish profile (.pubxml), I believe using this is analagous to checking the 'remove additional files at destination'
<SkipExtraFilesOnServer>False</SkipExtraFilesOnServer>
Then referencing the Publish Profile in msbuild:
<MSBuild Projects="proj.csproj"
Targets="WebPublish"
Properties="VisualStudioVersion=11.0;
Configuration=$(Configuration);
PublishProfile=$(Configuration).pubxml;
MSDeployServiceUrl=$(ServiceUrl);
UserName=$(MSDeployUsername);
Password=$(MSDeployPassword)" />
If not using publish profile, I'd think just adding the SkipExtraFilesOnServer=False in the build task properties would do the trick.