Visual Studio SDK - Handling File Add, Remove, and Rename Events

前端 未结 3 499
南方客
南方客 2021-01-03 04:06

I\'m working on a Visual Studio extension that should listen for events when the user adds, removes, or renames files in the current solution.

The answer to this que

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-03 04:57

    I know this is an old post by now, but for anyone else, who is searching for a fast solution. Take a look at the IVsTrackProjectDocuments2 class and it's matching IVsTrackProjectDocumentsEvents2 event interface.

    You will receive notifications for all project items (Not solution items!), including Solution Items, which match the following actions:

    • Rename Directories
    • Rename Files

    • Add Directories

    • Add Files

    • Remove Directories

    • Remove Files

    • SccStatusChanged (I am guessing, that it will fire after a file's source-control state changed.)

    These will contain an array of the changed items, their new state and the projects in which updates occurred. Additionally you will get a VS*FLAGS array, which contains more information about the current operation.

提交回复
热议问题