IVsTrackProjectDocumentsEvents2 Interface


Notifies clients of changes made to project files or directories.

Namespace:   Microsoft.VisualStudio.Shell.Interop
Assembly:  Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)

public interface IVsTrackProjectDocumentsEvents2

System_CAPS_pubmethodOnAfterAddDirectoriesEx(Int32, Int32, IVsProject[], Int32[], String[], VSADDDIRECTORYFLAGS[])

This method notifies the client after directories are added to the project.

System_CAPS_pubmethodOnAfterAddFilesEx(Int32, Int32, IVsProject[], Int32[], String[], VSADDFILEFLAGS[])

This method notifies the client after a project has added files.

System_CAPS_pubmethodOnAfterRemoveDirectories(Int32, Int32, IVsProject[], Int32[], String[], VSREMOVEDIRECTORYFLAGS[])

This method notifies the client when directories have been removed from the project.

System_CAPS_pubmethodOnAfterRemoveFiles(Int32, Int32, IVsProject[], Int32[], String[], VSREMOVEFILEFLAGS[])

This method notifies the client after files are removed from the project.

System_CAPS_pubmethodOnAfterRenameDirectories(Int32, Int32, IVsProject[], Int32[], String[], String[], VSRENAMEDIRECTORYFLAGS[])

This method notifies the client when directories have been renamed in the project.

System_CAPS_pubmethodOnAfterRenameFiles(Int32, Int32, IVsProject[], Int32[], String[], String[], VSRENAMEFILEFLAGS[])

This method notifies the client when files have been renamed in the project.

System_CAPS_pubmethodOnAfterSccStatusChanged(Int32, Int32, IVsProject[], Int32[], String[], UInt32[])

This method notifies the client when source control status has changed.


This method notifies the client when a project has requested to add directories.


This method notifies the client when a project has requested to add files.


This method notifies the client when a project has requested to remove directories.


This method notifies the client when a project has requested to remove files.


This method notifies the client when a project has requested to rename directories.


This method notifies the client when a project has requested to rename files.

When you subscribe to the IVsTrackProjectDocumentEvents2 events, you will receive event notification for all projects. Generally, you will not receive batched notification of these events unless two projects coordinate, as in the case of a nested project and the parent project.

Before adding, renaming, or deleting a file or directory, each project must call the appropriate OnQuery* method from IVsTrackProjectDocuments2 to check whether the operation is allowed. After the operation is completed, the project must then notify the OnAfter* method in IVsTrackProjectDocuments2. The environment sends out the appropriate event notifications after each call.

The parameters in the methods of IVsTrackProjectDocumentEvents2 generally consist of:

  • The relevant IVsProject2, or the array of IVsProject2 pointers.

  • Flags regarding the operation taking place.

  • An array of documents sorted by project. If there is only one project, then the ordering of files does not matter. If there is more than one project, the files must be grouped by their associated projects.

  • An array of first indices. These indices relate the array of projects to the array of documents. There is one first index for each project, which points to the first file in the array of documents that is controlled by that project. Since the array of documents is sorted by projects, all of the indices greater than one first index and less than the next first index belong to a given project. For example:




Visual Basic


0) a 1) b 2) c 3) d 4)

Visual C++


5) f 6) g 7) h

Visual C#


8) i 9) j 10) k 11) l

In this case:

Documents a, b, c, d, e (indices 0–4) belong to the Visual Basic Project.

Documents f, g, h (indices 5–7) belong to the Visual C++ Project.

Documents i, j, k, l (indices 8 and above) belong to the Visual C# Project.

Notes to Implementers:

A source control package implements this interface if it needs to track changes in a project, such as when files or directories are added, removed, or renamed. It is recommended that this interface be implemented; otherwise, the user may need to manually refresh the source control display to see any changes in status.

Notes to Callers:

Called by the environment in response to the addition, removal, or renaming of files or directories in a project.

Return to top