You are currently offline, waiting for your internet to reconnect

BUG: Scope of BuildEvents always vsBuildScopeSolution in Visual Studio .NET addins

Author:
Carlos Quintero MVP
COMMUNITY SOLUTIONS CONTENT DISCLAIMER
MICROSOFT CORPORATION AND/OR ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY, RELIABILITY, OR ACCURACY OF THE INFORMATION AND RELATED GRAPHICS CONTAINED HEREIN. ALL SUCH INFORMATION AND RELATED GRAPHICS ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT AND/OR ITS RESPECTIVE SUPPLIERS HEREBY DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THIS INFORMATION AND RELATED GRAPHICS, INCLUDING ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, WORKMANLIKE EFFORT, TITLE AND NON-INFRINGEMENT. YOU SPECIFICALLY AGREE THAT IN NO EVENT SHALL MICROSOFT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, PUNITIVE, INCIDENTAL, SPECIAL, CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF USE, DATA OR PROFITS, ARISING OUT OF OR IN ANY WAY CONNECTED WITH THE USE OF OR INABILITY TO USE THE INFORMATION AND RELATED GRAPHICS CONTAINED HEREIN, WHETHER BASED ON CONTRACT, TORT, NEGLIGENCE, STRICT LIABILITY OR OTHERWISE, EVEN IF MICROSOFT OR ANY OF ITS SUPPLIERS HAS BEEN ADVISED OF THE POSSIBILITY OF DAMAGES.
SUMMARY
When you set an event handler to capture EnvDTE.BuildEvents, the parameter Scope of the event is always set to vsBuildScopeSolution, even if you are building only a project in the Solution Explorer with the "Build" context menu.
SYMPTOMS
When you set an event handler to capture EnvDTE.BuildEvents, the parameter Scope of the event is always set to vsBuildScopeSolution, even if you are building only a project in the Solution Explorer with the "Build" context menu.
CAUSE
This seems a bug in the Visual Studio .NET IDE.
RESOLUTION
As workaround you can set event handlers to the different Build.BuildXXX commands on the main menu and context menus, but be aware that this workaround is affected by another bug:
MORE INFORMATION
Create a VS.NET addin that includes the following code (VB.NET):
 
   Private WithEvents m_objBuildEvents As EnvDTE.BuildEvents
 
   Public Sub OnConnection(ByVal application As Object, ByVal connectMode As Extensibility.ext_ConnectMode, _
      ByVal addInInst As Object, ByRef custom As System.Array) Implements Extensibility.IDTExtensibility2.OnConnection
 
      Dim objDTE As EnvDTE.DTE
 
      objDTE = CType(application, EnvDTE.DTE)

      m_objBuildEvents = objDTE.Events.BuildEvents
 
   End Sub
 
   Private Sub m_objBuildEvents_OnBuildBegin(ByVal Scope As EnvDTE.vsBuildScope, ByVal Action As EnvDTE.vsBuildAction) _
      Handles m_objBuildEvents.OnBuildBegin

      System.Windows.Forms.MessageBox.Show("OnBuildBegin with Scope: " & Scope.ToString)

   End Sub

 
Properties

Article ID: 555102 - Last Review: 05/03/2004 00:48:23 - Revision: 1.0

  • Microsoft Visual Studio .NET 2002 Professional Edition
  • Microsoft Visual Studio .NET 2002 Academic Edition
  • Microsoft Visual Studio .NET 2002 Enterprise Developer
  • Microsoft Visual Studio .NET 2002 Enterprise Developer
  • Microsoft Visual Studio .NET 2003 Enterprise Architect
  • Microsoft Visual Studio .NET 2003 Enterprise Developer
  • Microsoft Visual Studio .NET 2003 Professional Edition
  • kbpubmvp kbpubtypecca kbhowto KB555102
Feedback