views:

35

answers:

1

World's simplest task (see below) is not being executed after I publish my web application project. Any idea why? Thank you.

<Target Name="AfterPublish">
   <Copy SourceFiles="C:\A.txt" DestinationFiles="C:\B.txt" />
</Target>

+1  A: 
  • You must define override the target at the end of your file, after <Import ... />
  • Launch MSBuild with detailed verbosity to see why your target is ignored :

    msbuild project.csproj /t:Target_to_Launch /v:d
    

AfterPublish is called after Publish target, but Publish is not the target called when you publish a web application. Publish is the target for publishing ClickOnce application.

You'll have to find the target used when you call Publish in Visual Studio, it could be Package, WebPublish...

madgnome
It is right after the Import tag.
Mark
Here are some highlights from the output:Overriding target "AfterPublish" in project "c:\...\Microsoft.Common.targets" with target "AfterPublish" from project "C:\...\Ara.Web.csproj".Target "_DeploymentUnpublishable" in file "c:\...\Microsoft.Common.targets" from project "C:\...\Ara.Web.csproj":Task "Message" Skipping unpublishable project.I can publish it from within Visual Studio, but the AfterPublish task is not working.
Mark