tfsbuildtfs-2015azure-pipelinesapp-offline.htm

Using app_offline with TFS2015 RM


I am in the course of setting up continuous deployment to IIS using TFS 2015 RM and wanted to take an application offline before deployment. Upon little research have found good posts on achieving it through “app_offline.htm” file with following steps.

  1. Creating an “app_offline.htm” file in the "root" of the website but with a different name (app_offline.htm_) to avoid debugging or related problems.
  2. Before deployments, rename the file back to “app_offline” and place it in the destination web app.
  3. Post deployment, we delete the file from destination web app.

Currently, I have included the “Windows Machine File Copy” task to copy build binaries along with “app_offline.htm_” to destination web app and “Delete Files” task to delete it post deployment.

Now, All I want to understand is how to rename the file back to app_offline.htm before deployment. Help on this would be greatly appreciated!


Solution

  • There are many ways to do it:

    1. Using PowerShell (e.g. Rename-Item) script through PowerShell on Target Machines (rename file that on remove machine) or PowerShell (rename file on build agent machine) step/task
    2. Deploy web app through WinRM-IIS Web App Deployment step/task with Take App Offline option. (Install IIS Web App Deployment Using WinRM extension)
    3. Re-copy all files (include app_offline.html) to target machine through Windows Machine File Copy with Clean Target option