After Publish event in Visual Studio

前端 未结 5 1998
情书的邮戳
情书的邮戳 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:09

    Adding my 2 cents

    MS has confirmed, that when publishing to file system they don't have any target to launch after that.

    "We currently do not support executing custom targets after publish from VS for the file system protocol."

    Quoted from this SO question

    So what we ended up doing is:

    1. use AfterTargets="CopyAllFilesToSingleFolderForPackage" (runs just before the files are copied to the publish location)
    2. which executes a bat-file
    3. the bat-file starts with a timeout 10 command (waits 10 seconds) - for the lack of a better way.

    IMPORTANT: This bat file has to be executed asynchronously so the publish process continues after it's been launched, please refer to this SO answer on how to do that.

提交回复
热议问题