Custom app_offline.htm file during publish

后端 未结 9 532
遇见更好的自我
遇见更好的自我 2020-12-03 00:58

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 publis

9条回答
  •  不知归路
    2020-12-03 01:54

    You can use a batch file which calls the compiler with the current directory information as parameters... It then copies app_offline.htm and copies the new file over. Run it from where the source is.

    I personally use a program which is just a bit more elaborate then the batch and also checks hash's of files to determine if they need updating makes a zip of new files and extracts it to the remote host and eliminates files we designate are for unit testing when going from test to production. I have also combined SVN integration into my solution so when you publish for test or production you also optionally commit to SVN. The program is stored on a network drive and is called from a batch file on the local PC with the current directory info. This way dev's dont have to update to the new deployer or the app_offline if any changes occur. Finally it removes the app_offline.

    Check out http://msdn.microsoft.com/en-us/library/system.web.compilation(v=vs.80).aspx for more info or http://msdn.microsoft.com/en-us/library/ms229863(v=vs.80).aspx if you are just making a quick batch!

    Additionally in the post you initially referenced and I have also verified you can actually change it but you change it for others using the publish feature as well. This is why you were given the answer you were.

提交回复
热议问题