Hi @Thomas Nørgaard ,
Thanks for using Microsoft Q&A. I believe your scenario can be achieved using MS deploy but comes with some limitations as stated below:
- App offline file should exist in the destination server and need to provide relative path.
- Destination provider types are limited (we set
dest:autofor MSBuild package, which doesn't support custom app offline feature).
You can also upload the custom app_offline, deploy the package and then remove the uploaded custom file after deployment following these steps:
To deploy an App_offline file to a destination IIS website, you need to invoke MSDeploy.exe using the Web Deploy contentPath provider. The contentPath provider supports both physical directory paths and IIS website or application paths, which makes it the ideal choice for synchronizing a file between a Visual Studio project folder and an IIS web application. To deploy the file, your MSDeploy command should resemble this:
msdeploy.exe –verb:sync
-source:contentPath="[Project folder]\App_offline.template.htm"
-dest:contentPath="[IIS application path]/App_offline.htm",
computerName="[Destination web server]"
To remove the file from the destination site at the end of the deployment process, your MSDeploy command should resemble this:
msdeploy.exe –verb:delete
-dest:contentPath="[IIS application path]/App_offline.htm",
computerName="[Destination web server]"
Hope that helps!
Best,
Grace