How to backup existing database and website as part of a MSDeploy package?
I am researching one-click deployment with Visual Studio 2010, the current deployment process involves zipping up the contents of the IIS folder and taking a backup of the current database before completing the remaining manual deploymen开发者_如何学JAVAt steps. This allows us to roll back a deployment, I need to retain the essence of this process if not the specifics.
Is there a way of automating this with MSDeploy?
You can have MSDeploy execute a batch file that backs up the IIS directory (see example)
You can also write some SQL, put it in a .sql file, execute the SQL script in the batch file as well. See this example to at least get a start. It is for SQL server, but if you are not using that then hopefully the database you are using has something similar.
Finally I found the answer, thank you to kniemczak for posting the information about how to backup IIS and SQL Server from the command line.
- Automating ASP.NET MVC deployments using Web Deploy
- Web Deploy runCommand Provider
It seems the following:
msdeploy.exe -verb:sync -source:runCommand='C:\Scripts\Backup.cmd' -dest:auto,computername=192.168.0.1
Should cover my needs.
精彩评论