有什么办法发布时,将调用自定义代码? [英] Is there any way to call custom code when publishing?

查看:123
本文介绍了有什么办法发布时,将调用自定义代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们现在有相当大的网站,建立在C#/ Asp.Net。我们有两个发布配置文件,一个用于临时,一个用于生产。他们一直在使用标准的Web部署发布配置的。

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.

这可能吗?

推荐答案

虽然我没有测试它有一些在这里的方向

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(

真正简单的例子:

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

这篇关于有什么办法发布时,将调用自定义代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆