Event Objects (Specific to Types of Projects)
Most of the available event objects specific to Visual C#, Visual Basic, and Visual J# are represented as properties on the VSProjectEvents2 object. ProjectItemsEvents and ProjectsEvents objects are also available per project type basis. The following table lists all of the Visual Studio event objects specific to project types. To see the events each object offers, click the link.
Event Objects
| Object Name | Description |
|---|---|
| Provides events for the build manager. | |
| Provides Imports events. Visual Basic only. | |
| Provides events for adding, changing or removing project references. | |
| Provides events for adding, changing or removing Web references. | |
| ProjectItemsEvents | Provides events for project items. These events are defined for all Visual Studio project types. |
| ProjectsEvents | Provides events for projects. These events are defined for all Visual Studio project types. |
Specifying the Project Type
To retrieve the various project type specific event objects from the automation model, use the following syntax:
// Declaration. Private EnvDTE.ProjectsEvents prjEventHandler; // Retrieve the event objects from the automation model. prjEventHandler = EnvDTE.Events.GetObject("VBReferencesEvents");
Or
// Declaration. private VSLangProj.ReferencesEvents refEvents; // Retrieve the event objects from the automation model refEvents = (VSLangProj.ReferencesEvents) EnvDTE.Events.GetObject("CSharpReferencesEvents");
The name that is passed to GetObject reflects the project type. The table below provides a complete list of all the project type specific event objects for Visual C#, Visual Basic, and Visual J# projects.
Listing of Project Type Specific Event Names
| Event Object Name | Description |
|---|---|
| VBBuildManagerEvents | Returns the BuildManagerEvents object for Visual Basic projects. |
| VBImportsEvents | Returns the ImportsEvents object for Visual Basic projects. |
| VBProjectItemsEvents | Returns the ProjectItemsEvents object for Visual Basic projects. |
| VBProjectsEvents | Returns the ProjectsEvents object for Visual Basic projects. |
| VBReferencesEvents | Returns the ReferencesEvents object for Visual Basic projects. |
| VJSharpBuildManagagerEvents | Returns the BuildManagerEvents object for Visual J# projects. |
| VJSharpProjectItemsEvents | Returns the ProjectItemsEvents object for Visual J# projects. |
| VJSharpProjectsEvents | Returns the ProjectsEvents object for Visual J# projects. |
| VJSharpReferencesEvents | Returns the ReferencesEvents object for Visual J# projects. |
| CSharpBuildManagerEvents | Returns the BuildManagerEvents object for Visual C# projects. |
| CSharpProjectItemsEvents | Returns the ProjectItemsEvents object for Visual C# projects. |
| CSharpProjectsEvents | Returns the ProjectsEvents object for Visual C# projects. |
| CSharpReferencesEvents | Returns the ReferencesEvents object for Visual C# projects. |
These strings can be found in the registry under the key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Packages\<Package GUID>. The Package GUIDs are:
-
164B10B9-B200-11D0-8C61-00A0C91E29D5 for Visual Basic project system.
-
E6FDF8B0-F3D1-11D4-8576-0002A516ECE8 for Visual J# project system.
-
FAE04EC1-301F-11D3-BF4B-00C04F79EFBC for Visual C# project system.
Note These GUIDs are valid only in Microsoft Visual Studio 2005.