I want to write an extension on dgml file. Code map of Solution in visual studio. How do I plug-in my code on a context menu of links shown in the diagram
-
Hi, what links? And it could be better if you share more details about what function will your extension have. – LoLance Apr 12 '19 at 05:50
-
In Visual Studio 2015, Toolbar option-> Architecture-> Generate Code Map for Solution. When the code map diagram is generated, it shows links between classes and/or assemblies in the solutions. This is a more a like PoC I am doing,therefore I just wanted to open another window from the context menu. This is what I want to achieve using Visual Studio Extension. Of If possible then any other way to do it – AjinkyaRaj Apr 12 '19 at 10:58
-
Actually, not familiar with the extension about 'diagram'. The topic about this is rare, I'm trying to involve someone experienced at this to help, any update I will share here. Please be patient :) – LoLance Apr 15 '19 at 08:50
1 Answers
I'm uncertain if there are any extensibility points build into the dgml editor, but you can certainly add menu items to the "Architecture" drop down menu item with a VS extension built with the Visual Studio SDK.
You'll want to read up on developing Visual Studio extensions, so that you are familiar with how menu items (also referred to as commands) are added to the VS IDE. Also, there are two categories of windows you can display in Visual Studio. Tool Windows, and Document Winodws. You'll need to figure out which type fits your particular requirements. Generally speaking if your underlying data is stored in a file, you'll most likely want to implement a document window (also known as a custom editor or designer). For example, the window displayed after selecting "Generate Code Map for solution" is a custom designer for .DGML files.
Below are a few links to get you pointed in the right direction.
- Visual Studio SDK
- Create an extension with a menu command
- Create an extension with a tool window
- Walkthrough: Create a custom editor
- VSSDK Extensibility Samples (github)
Sincerely,

- 2,013
- 1
- 10
- 8
-
Well I have already tried the mentioned things, However I am trying to find a specific area where I can get my command menu item on the context menu of links in .dgml files – AjinkyaRaj Apr 25 '19 at 03:48
-
If the context menu is one being displayed via the menuing services implemented by the VS IDE, you should be able to add your own items to it. However, if the menu being displayed is a WPF resource or similar, it's not extensible. The way to check is to turn on the EnableVSIPLogging switch and then use CTRL+SHIFT+RIGHTCLICK, and if the diagnostic dialog appears, you can glean the guid:id pair of the context menu, to parent your menu group off of. See https://stackoverflow.com/questions/31759396/vsix-adding-a-menu-item-to-the-visual-studio-editor-context-menu for details. – Ed Dore May 01 '19 at 05:54