user1166145
user1166145

Reputation: 203

Is there any way to call custom code when publishing?

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?

Upvotes: 5

Views: 2805

Answers (1)

Carl Clark
Carl Clark

Reputation: 311

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

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>

Upvotes: 6

Related Questions