none
why is OnBuildDone event not firing?

    Question

  • Why are neither of the onBuildDone and On BuildProjConfigDone events firing when I build a solution ( after my package has been initialized )?

    a visual studio package.  In the Initialize method is the following code to hook the build events:

        public static EnvDTE80.DTE2 Dte2
        { get; set; }
    
          // hook solution build events
          {
            Dte2 = this.GetService(typeof(EnvDTE.DTE)) as EnvDTE80.DTE2;
            if (Dte2 != null)
            {
              Dte2.Events.BuildEvents.OnBuildDone
                += new EnvDTE._dispBuildEvents_OnBuildDoneEventHandler(BuildEvents_OnBuildDone);
              Dte2.Events.BuildEvents.OnBuildProjConfigDone
                += new EnvDTE._dispBuildEvents_OnBuildProjConfigDoneEventHandler(BuildEvents_OnBuildProjConfigDone);
              Trace.WriteLine("OnBuildDone event hooked.");
            }
          }
    

    and the event handlers:

        void BuildEvents_OnBuildProjConfigDone(
          string Project, string ProjectConfig, string Platform, string SolutionConfig, bool Success)
        {
          Trace.WriteLine("OnBuildProjConfigDone event handler. Project:" + Project +
            " ProjectConfig:" + ProjectConfig + " Platform:" + Platform + 
            " SolutinoConfig:" + SolutionConfig +
            " Success:" + Success) ;
        }
    
        void BuildEvents_OnBuildDone(EnvDTE.vsBuildScope Scope, EnvDTE.vsBuildAction Action)
        {
          Trace.WriteLine("OnBuildDone event handler. Scope:" + Scope.ToString() +
            " Action:" + Action.ToString());
        }
    

    If it helps, here is the content of the Output window in the visual studio instance which launched the exp instance:

    Entering constructor for: Company.DemoPackage.DemoPackagePackage
    Entering Initialize() of: Company.DemoPackage.DemoPackagePackage
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.Debugger.Runtime\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Debugger.Runtime.dll'
    OnBuildDone event hooked.
    MenuItemCallback. 2de6a96a-6647-42da-8e63-48418365de86 : 256 : Supported|Enabled|Visible
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\assembly\GAC\Microsoft.VisualStudio.VSHelp80\8.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.VSHelp80.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\assembly\GAC\Microsoft.VisualStudio.VSHelp\7.0.3300.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.VSHelp.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.Build\v4.0_4.0.0.0__b03f5f7f11d50a3a\Microsoft.Build.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.Build.Framework\v4.0_4.0.0.0__b03f5f7f11d50a3a\Microsoft.Build.Framework.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.VisualStudio.Shell.9.0\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Shell.9.0.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.Shell.Interop.10.0\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Shell.Interop.10.0.dll'
    Entering constructor for: Microsoft.VisualStudio.Internal.WPFFlavor.WPFPackage
    Entering Initialize() of: Microsoft.VisualStudio.Internal.WPFFlavor.WPFPackage
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.ProjectAggregator\8.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.ProjectAggregator.dll'
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\CustomMarshalers\v4.0_4.0.0.0__b03f5f7f11d50a3a\CustomMarshalers.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.VisualStudio.Design\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Design.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.VisualStudio.CSharp.Services.Language\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.CSharp.Services.Language.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Microsoft.VisualStudio.CSharp.Services.Language.Interop.dll'
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Threading.Tasks.Dataflow\v4.0_4.0.0.0__b77a5c561934e089\System.Threading.Tasks.Dataflow.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.Build.Tasks.v4.0\v4.0_4.0.0.0__b03f5f7f11d50a3a\Microsoft.Build.Tasks.v4.0.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    The thread 'RequestBuilder thread' (0x16ec) has exited with code 0 (0x0).
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.VisualStudio.TextTemplating.Interfaces.10.0\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.TextTemplating.Interfaces.10.0.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.VisualStudio.TextTemplating.10.0\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.TextTemplating.10.0.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Microsoft.Data.Entity.Design.BootstrapPackage.dll'
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.VisualStudio.Modeling.Sdk.10.0\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Modeling.Sdk.10.0.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Microsoft.Data.Entity.Design.dll'
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Microsoft.Data.Tools.VSXmlDesignerBase.dll'
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Microsoft.Data.Tools.XmlDesignerBase.dll'
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Microsoft.Data.Entity.Design.EntityDesigner.dll'
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.VisualStudio.Modeling.Sdk.Diagrams.10.0\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Modeling.Sdk.Diagrams.10.0.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\Microsoft.VisualStudio.Modeling.Sdk.Diagrams.GraphObject.10.0\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Modeling.Sdk.Diagrams.GraphObject.10.0.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.XmlEditor\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.XmlEditor.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.VisualStudio.Package.LanguageService.10.0\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Package.LanguageService.10.0.dll'
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.VisualStudio.XmlEditor\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.XmlEditor.dll'
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\assembly\GAC\Microsoft.VisualStudio.Debugger.Interop\8.0.1.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Debugger.Interop.dll'
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Data.Entity\v4.0_4.0.0.0__b77a5c561934e089\System.Data.Entity.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\PresentationBuildTasks\v4.0_4.0.0.0__31bf3856ad364e35\PresentationBuildTasks.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.VisualStudio.Diagnostics.Common\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Diagnostics.Common.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.MSXML\8.0.0.0__b03f5f7f11d50a3a\Microsoft.MSXML.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Microsoft.VisualStudio.Diagnostics.Measurement.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.TextManager.Interop.10.0\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.TextManager.Interop.10.0.dll'
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies\Microsoft.Data.Entity.Design.Extensibility.dll'
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.VisualStudio.CSharp.SmartTags\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.CSharp.SmartTags.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.VisualStudio.Language.Intellisense\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Language.Intellisense.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.VisualStudio.Language.StandardClassification\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Language.StandardClassification.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\WindowsFormsIntegration\v4.0_4.0.0.0__31bf3856ad364e35\WindowsFormsIntegration.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\UIAutomationTypes\v4.0_4.0.0.0__31bf3856ad364e35\UIAutomationTypes.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'MetadataViewProxies_f6813a9b-1b69-43c3-a2ee-074f5226fb91'
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.VisualStudio.VirtualTreeGrid\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.VirtualTreeGrid.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Accessibility\v4.0_4.0.0.0__b03f5f7f11d50a3a\Accessibility.dll'
    The thread '<No Name>' (0xe54) has exited with code 0 (0x0).
    The thread '<No Name>' (0x15a8) has exited with code 0 (0x0).
    The thread '<No Name>' (0x1574) has exited with code 0 (0x0).
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Data.Entity.Design\v4.0_4.0.0.0__b77a5c561934e089\System.Data.Entity.Design.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    The thread 'RequestBuilder thread' (0x174c) has exited with code 0 (0x0).
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'rmfp3u4r'
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\System.Data.OracleClient\v4.0_4.0.0.0__b77a5c561934e089\System.Data.OracleClient.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Program Files (x86)\Microsoft SQL Server\110\DAC\Bin\Microsoft.Data.Tools.Integration.dll'
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Program Files (x86)\Microsoft SQL Server\110\DAC\Bin\Microsoft.Data.Entity.Design.Model.dll'
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Program Files (x86)\Microsoft SQL Server\110\DAC\Bin\Microsoft.Data.Tools.Design.XmlCore.dll'
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Program Files (x86)\Microsoft SQL Server\110\DAC\Bin\Microsoft.Data.Tools.Schema.Sql.dll'
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Program Files (x86)\Microsoft SQL Server\110\DAC\Bin\Microsoft.Data.Tools.Model.dll'
    'devenv.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.Data.Entity.Build.Tasks\v4.0_4.0.0.0__b03f5f7f11d50a3a\Microsoft.Data.Entity.Build.Tasks.dll'
    The thread 'MSBuild Pipe Worker' (0x620) has exited with code 0 (0x0).
    The thread '<No Name>' (0x14c0) has exited with code 0 (0x0).
    The thread '<No Name>' (0x160c) has exited with code 0 (0x0).
    The thread '<No Name>' (0x960) has exited with code 0 (0x0).
    The thread '<No Name>' (0x8d4) has exited with code 0 (0x0).
    The thread '<No Name>' (0x1088) has exited with code 0 (0x0).
    The thread '<No Name>' (0x7c8) has exited with code 0 (0x0).
    The thread '<No Name>' (0xf90) has exited with code 0 (0x0).
    The thread '<No Name>' (0x9a0) has exited with code 0 (0x0).
    The thread 'MSBuild Pipe Worker' (0xe18) has exited with code 0 (0x0).
    The thread 'MSBuild Pipe Worker' (0x15d8) has exited with code 0 (0x0).
    


    Thursday, April 05, 2012 4:16 PM

Answers

  • got the answer. The Package class has to hold a reference to the Dte2.Events.BuildEvents object.

        public EnvDTE.BuildEvents BuildEvents
        { get; set; }
    
    
              this.BuildEvents = Dte2.Events.BuildEvents;
    
              this.BuildEvents.OnBuildDone
                += new EnvDTE._dispBuildEvents_OnBuildDoneEventHandler(BuildEvents_OnBuildDone);
              this.BuildEvents.OnBuildProjConfigDone
                += new EnvDTE._dispBuildEvents_OnBuildProjConfigDoneEventHandler(BuildEvents_OnBuildProjConfigDone);
    

    • Marked as answer by Steve Richter Thursday, April 05, 2012 4:42 PM
    Thursday, April 05, 2012 4:42 PM

All replies