Is there any way to call custom code when publishing?

非 Y 不嫁゛ 提交于 2019-12-19 03:31:28

问题


We have quite a large site now, build in C#/Asp.Net. We've got two publishing profiles, one for Staging and one for Production. They have been made using standard Web Deploy publish profiles.

What we now want to do is to send out an email any time we publish to Production. What I would like to do is find some sort of post publish method that I can hook into. Sort of like the Post-build event, except for publishing instead.

Is this possible?


回答1:


Although I haven't tested it out there is some direction here

  • Post Publish Events
  • http://msdn.microsoft.com/en-us/library/ms366724.aspx
  • http://msdn.microsoft.com/en-us/library/7z253716.aspx (MSBuild Tasks)
  • http://msdn.microsoft.com/en-us/library/t9883dzc.aspx (Create a custom MSBuild Task(

Real simple example:

<Target Name="BeforePublish" BeforeTargets="MSDeployPublish">
  <Exec Command="D:\Pre.bat" />
</Target>
<Target Name="AfterPublish" AfterTargets="MSDeployPublish">
  <Exec Command="D:\Post.bat" />
</Target>


来源:https://stackoverflow.com/questions/15605489/is-there-any-way-to-call-custom-code-when-publishing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!