locked
How to stop the build if pre-build command fails RRS feed

  • Question

  • In my VS extension, I added pre-build handler by using this:

    DTE.Events.BuildEvents.OnBuildProjConfigBegin

    It works fine. The issue is, even if my pre-build handler fails (say, throws exception), the build process continues while I want it to stop.  How to achieve that ?

    Thanks.

    Thursday, June 14, 2018 4:25 PM

All replies

  • Hi LingW_2008,

    >>It works fine. The issue is, even if my pre-build handler fails (say, throws exception), the build process continues while I want it to stop.  How to achieve that ?

    please try to use OnBuildBegin, which receive events before or after a build is performed. You receive as parameters the scope (solution, project) and the action (build, rebuild, clean, etc.)

    Best regards,

    Zhanglong


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, June 19, 2018 5:43 AM
  • Hmm, it does not work. Throwing exception in OnBuildBeging does not stop the build process either. 
    Wednesday, June 20, 2018 7:44 PM