title: After Publish event in Visual Studio
body: <p>I am trying to invoke simple task after publish event. When I say "publish", I mean publish in Visual Studio, right click on project and pressing "Publish...". I have included (Imported) targets file in project file which works fine because I have already tested it on Build event.
  I have found at <a href="http://msdn.microsoft.com/en-us/library/ms366724.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/ms366724.aspx</a> that there is AfterPublish event which should do what I need, but it doesn't. 
  I am not sure if this is a same event which should trigger on Publish in Visual Studio, someone please clarify this.
  My question is how to trigger any kind of task from targets file on Publish in Visual Studio?</p>
  
  <p>I have tried this in targets file:</p>
  
  <pre><code>&lt;Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt;
      &lt;Target Name="AfterPublish"&gt;
          &lt;Message Label="Test"&gt;&lt;/Message&gt;        
          &lt;Warning Label="Test"&gt;&lt;/Warning&gt;
      &lt;/Target&gt;   
  &lt;/Project&gt;
  </code></pre>
  
  <p>I am using Visual Studio 2010.</p>
  
  <p>EDIT:</p>
  
  <p>I am actually looking for any way to execute certain action on Publish in Visual Studio. I was also thinking of adding Build Events, but I have no idea how to determine whether it is Publish in progress or not.</p>
  
  <p>EDIT:
  @Alexey Shcherbak thank you for your fast reply.
  I am getting this in my MSBuild output:</p>
  
  <pre><code>12/10/2012 12:29:40 AM:        Done executing task "CallTarget".
  12/10/2012 12:29:40 AM:        Done building target "PipelinePreDeployCopyAllFilesToOneFolder" in project "PublishTestApp.csproj".
  12/10/2012 12:29:40 AM:Done building project "PublishTestApp.csproj".
  Deleting existing files...
  Publishing folder /...
  Publishing folder Account...
  Publishing folder bin...
  Publishing folder Scripts...
  Publishing folder Styles...
  ========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
  ========== Publish: 1 succeeded, 0 failed, 0 skipped ==========
  </code></pre>
  
  <p>So my task will executes right after PipelinePreDeployCopyAllFilesToOneFolder but before actual coping of the files and I don't consider Publish being done yet at that point.
  Of course, I did actually test this, so in MSBuild task I was executing simple read from text file that is suppose to be copied in the Publish folder, and it failed.</p>