5

Is it possible to configure Visual Studio 2012 to automatically create (and delete) the app_offline.htm file when using ftp as the publishing method?

I tried to create the file by hand and add it to the solution (so it would be uploaded automatically and I could delete it by hand once the publishing process is done).
But because it exists in my solution, every request is redirected to it and I can't debug anything.

Changing the name to app_offline.htm.deactivated during development and changing it back to app_offline.htm before publishing doesn't seem like a perfect solution.

If VS12 doesn't support this natively, I would be happy to use any available extension.

Edit: I noticed, that the app_offline.htm file is created when activating delete all content before publishing but not when this option isn't selected.

Inserting <EnableMSDeployAppOffline>true</EnableMSDeployAppOffline> to the .pubxml file didn't change anything.

Christopher
  • 2,005
  • 3
  • 24
  • 50

1 Answers1

-1

From: http://www.asp.net/mvc/tutorials/deployment/visual-studio-web-deployment/deploying-a-code-update

It says:

You can configure Web Deploy to automatically put a default app_offline.htm file on the server when it starts deploying and remove it when it finishes. To do that all you have to do is add the following XML element to your publish profile (.pubxml) file:

<EnableMSDeployAppOffline>true</EnableMSDeployAppOffline>
  • This didn't work for me, please see my edit. How can I configure VS to **always** create the file? – Christopher Jun 03 '14 at 19:15
  • Then the only thing I can think of that you can do is write a custom MSDeploy script that you run on the command line instead of using the one built into visual studio. There would basically be 3 lines: 1) msdeploy command to deploy the app_offline.htm, 2) msdeploy to deploy the site, 3) msdeploy to remove the app_offline.htm. Here is the command line syntax reference: http://technet.microsoft.com/en-us/library/dd569106(v=ws.10).aspx – Michael Adamission Jun 03 '14 at 20:44