简体   繁体   中英

Run before & after scrips with .Net Web Deploy

We have an ASP.Net 4.5.2 WebForms application in Visual Studio 2015. We want to create a Web Deploy package that:

  • Backs up certain folders & files on the target system/IIS server
  • Deletes the old files
  • Copies the new files
  • Copies the backup up files back
  • Possibly sets some folder file permissions

Is WebDeploy the right tool for this? Or is it too basic for such "pre" and "after" tasks?

Would the runCommand provider be the way to go? https://technet.microsoft.com/de-de/library/ee619740(v=ws.10).aspx

Any hints would be appreciated

Yes, you can use the preSync and postSync MSDeploy operation settings:

msdeploy -verb:sync -preSync:runCommand="net stop w3svc" -source:webserver60 -dest:auto,computername=serverA -verbose -postSync:runCommand="net start w3svc"

https://technet.microsoft.com/en-us/library/ee619740(v=ws.10).aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM