I've been struggling to setup automatic backup, but seems to have hit a wall.
Following this document, and using Powershell, I've enabled the backups (TurnOn-Backups -On $true, then Configure-Backups -SiteName "test1" -Enabled $true; so Get-BackupSettings -SiteName "test1" tells me the backup is enabled).
However, whenever I do a publish from Visual Studio - no backup is created. I've set the backup path, the permissions are set to allow everything for everyone.. so I have no idea what else I can check.
Short Answer: Currently broken in VS 2010 "Web One Click Publish" feature. :'(
I spent nearly an entire week working closely with the MS Dev team and trying everything imaginable on this one and have yet to find a solution that doesn't involve the msdeploy.exe command utility (i.e. no luck for doing this from VS directly using the "Web One Click Publish" feature). :(
Hopefully they make a patch to address this issue in VS 2010 SP1. Web Deploy is supported (See "Features" section) but the Automatic Backup feature is not. I know this isn't the answer you were looking for, nor was I, but the sad fact of the matter nevertheless.
I think the best you can hope for at this point is as Sayed answered here, and while old, remains the only solution at this time (Note: The msbuild tab for the old VS 2008 Web Site template is now "Build Events" under the Compile tab in VS 2010 Web App projects). Only downside to this method is that it will create a backup every time you compile, not just when you deploy. Otherwise you'll have to write a special script that you run prior to each publish.
On a side note, you can also edit your web deploy configuration via IIS Manager at the server level using the "Configuration Editor" (must have the Management role installed).
I managed to get VS2010 to deploy automatic backups, by stealing some ideas from this question: msdeploy (Web Deploy) failing with 401 auth issues
First install Web Deploy v3.5 on your local computer - the one with VS2010 installed on it.
Now edit your VS2010 environment config:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe.config # or C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe.config
<assemblyBinding> node, and add the following just inside it:
<dependentAssembly> <assemblyIdentity name="Microsoft.Web.Deployment" publicKeyToken="31bf3856ad364e35" culture="neutral"/> <bindingRedirect oldVersion="18.104.22.168" newVersion="22.214.171.124"/> </dependentAssembly>
Save, and restart VS2010.
You should now find you can use one click publishing in VS2010 to push to a server running Web Deploy v3, and if you've configured backups correctly on the server (see @Chiramisu's answer) then backups should be successfully created! Woop!