Reputation: 71
I would like to execute script after Publish finishes. To start publish in Visual Studio I right click on project -> Publish... For publishing I use FTP method. I know I can set up Target in .xproj or .pubxml files but I can not find actual event that will call my target. My .pubxml file lok like this:
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FTP</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish>htttp://example.com</SiteUrlToLaunchAfterPublish>
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<PublishFramework>netcoreapp1.0</PublishFramework>
<UsePowerShell>False</UsePowerShell>
<publishUrl>ftp://example</publishUrl>
<DeleteExistingFiles>False</DeleteExistingFiles>
<FtpPassiveMode>False</FtpPassiveMode>
<FtpSitePath>myFolder</FtpSitePath>
<UserName>john</UserName>
<_SavePWD>False</_SavePWD>
</PropertyGroup>
<Target Name="MyTarget">
<Message Text="Hello..." />
</Target>
</Project>
I want to call target MyTarget. I have looked everywhere but I can not find way to do this.
Upvotes: 0
Views: 2121
Reputation: 33708
Based on the detail log (Diagnostic) of web app publish with FTP method (VS2015), the last target is GatherAllFilesToPublish, which is running before publish file to the folder of FTP.
Try do to other things in a target after GatherAllFilesToPublish. For example (edit your project file XXX.csproj):
<Target Name="CustomPostPublishActions" AfterTargets="GatherAllFilesToPublish">
<Message Text="This is custom target" Importance="high" />
</Target>
Upvotes: 2