views:

300

answers:

3

When I publish my ASP.NET MVC application it generates a app_offline.htm file to take the site offline while it updates the website and then deletes the file once the publish is successful.

This is cool and I really like the idea, but I want to create my own custom app_offline.htm file that the publish action is aware of and put it somewhere where it doesn't effect my development site - i.e. it doesn't sit in the root of my development site rendering it offline all the time.

TIA,
Charles

EDIT: From the comments on Scott Gu's post about app_offline.htm, it seems that customization of the app_offline.htm file wasn't possible with VS 2005 - has this changed with VS 2008 and now VS 2010?

A: 

Back in 2006, Scott Gu said that there was no way to customize the file which VS generates on Publish.

Comment within original article

I'd be interested in solving this too, but I was unable to turn up anything definitive to the contrary on Google.

Superstringcheese
A: 

Have you seen this?

App_Offline.htm

It might not be (exactly) what you want but it does solve the issue I think.

griegs
Oops. sorry, didn't see your edit.
griegs
+2  A: 

I use my own

app_offline.htm_

file in the solution, which gets published. My deployment script then renames it (removing the trailing _) to make it active.

I can then run my db scripts/do whatever then rename the file bringing the site back.

Andrew Bullock
How does your deployment script remove the trailing slash? Is the renaming of the file in the last step a manual thing?
Charlino
i simply make app_offline.htm as i normally would (simple html/css) and add this to my project (but called .htm_ so it doesnt take my dev site offline when debugging). make sure you set the build type to content. i publish and upload the code, then i have a deployment script which copies the code over, and renames `app_offline.htm_` to `app_offline.htm`. simples
Andrew Bullock
Does you deployment script then delete the file once it's done?
Charlino