After Publish event in Visual Studio

前端 未结 5 1994
情书的邮戳
情书的邮戳 2020-12-05 13:41

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 in

5条回答
  •  粉色の甜心
    2020-12-05 14:10

    The Publish context menu isn't running "Publish" target (if we are speaking about publishing website, not publishing ClickOnce package).

    If you are using VS2010 - context menu will run "PipelinePreDeployCopyAllFilesToOneFolder" target, and in VS2012 (keep this in mind if you are going to switch) it will run "MSDeployPublish" target.

    I suppose you should read this question and answer. Jez and I provided pretty comprehensive answer on how to hook to Before\After publish target.

    In short - for MSBuild version>=4.0 you could use this approach

    
                
        
    
    

    @Edit1: use CopyAllFilesToSingleFolderForPackage instead of PipelinePreDeployCopyAllFilesToOneFolder - the files should be copied after this target. If you need to fire your target only when it launched in VS context - check the link I posted and add some more conditions - to check for Visual studio launch like this Condition="'$(BuildingInsideVisualStudio)'=='true' AND '$(VisualStudioVersion)'=='10.0'" If you add more context like what kind of target do you want to launch after publishing etc. - it could add more context and help others to understand the issue

提交回复
热议问题