C
C#•3y ago
Binto86

How to add command to right click context menu for solution explorer in VS 2022 extension

I am trying to create .vsix extension , i want to create command which shows up when i right click .razor file, but i wasn't able to find the correct id for parent to do this, can someone help me please?
29 Replies
Pobiega
Pobiega•3y ago
adding stuff to the registry
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Classes\CLSID\{23170F69-40C1-278A-1000-000100020000}]
@="7-Zip Shell Extension"

[HKEY_CURRENT_USER\Software\Classes\CLSID\{23170F69-40C1-278A-1000-000100020000}\InprocServer32]
@="C:\\Users\\robin\\scoop\\apps\\7zip\\current\\7-zip.dll"
"ThreadingModel"="Apartment"

[HKEY_CURRENT_USER\Software\Classes\*\shellex\ContextMenuHandlers\7-Zip]
@="{23170F69-40C1-278A-1000-000100020000}"

[HKEY_CURRENT_USER\Software\Classes\Directory\shellex\ContextMenuHandlers\7-Zip]
@="{23170F69-40C1-278A-1000-000100020000}"

[HKEY_CURRENT_USER\Software\Classes\Folder\shellex\ContextMenuHandlers\7-Zip]
@="{23170F69-40C1-278A-1000-000100020000}"

[HKEY_CURRENT_USER\SOFTWARE\7-Zip\Options]
"MenuIcons"=dword:00000001
"CascadedMenu"=dword:00000001
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Classes\CLSID\{23170F69-40C1-278A-1000-000100020000}]
@="7-Zip Shell Extension"

[HKEY_CURRENT_USER\Software\Classes\CLSID\{23170F69-40C1-278A-1000-000100020000}\InprocServer32]
@="C:\\Users\\robin\\scoop\\apps\\7zip\\current\\7-zip.dll"
"ThreadingModel"="Apartment"

[HKEY_CURRENT_USER\Software\Classes\*\shellex\ContextMenuHandlers\7-Zip]
@="{23170F69-40C1-278A-1000-000100020000}"

[HKEY_CURRENT_USER\Software\Classes\Directory\shellex\ContextMenuHandlers\7-Zip]
@="{23170F69-40C1-278A-1000-000100020000}"

[HKEY_CURRENT_USER\Software\Classes\Folder\shellex\ContextMenuHandlers\7-Zip]
@="{23170F69-40C1-278A-1000-000100020000}"

[HKEY_CURRENT_USER\SOFTWARE\7-Zip\Options]
"MenuIcons"=dword:00000001
"CascadedMenu"=dword:00000001
this is what 7zip does when you install it
Binto86
Binto86OP•3y ago
i don't think i understand what do you mean i wan to add item to file right click menu
Binto86
Binto86OP•3y ago
something like this
No description
Binto86
Binto86OP•3y ago
my problem is that i can not find the correct id
Pobiega
Pobiega•3y ago
Oh, you want to do it inside your VS extension
Binto86
Binto86OP•3y ago
I am trying to create .vsix extension
Pobiega
Pobiega•3y ago
then yeah nevermind, I misread it and thought you meant the rightclick file context menu in explorer
Binto86
Binto86OP•3y ago
wel yes, but solution explorer 😅
Pobiega
Pobiega•3y ago
You should probably include the VS version you are extending with too since vsix is for both vs code and vs, and all verisons of both but the code itself might be different
Binto86
Binto86OP•3y ago
vs 2022 the best i can do is IDM_VS_CTXT_ITEMNODE, but that still doesn't work
Pobiega
Pobiega•3y ago
I suggest you edit the topic to "How to add command to right click context menu for solution explorer in VS 2022 extension" Good luck
Binto86
Binto86OP•3y ago
thanks
Pobiega
Pobiega•3y ago
@admsnyder has made extensions, so maybe he can answer if he is available 🙂
Binto86
Binto86OP•3y ago
hopefuly, because now it seems like i broke everything and it doesn't show up even at the default location
AdmSnyder
AdmSnyder•3y ago
@binto86 yeah, you can add context menu commands let me get to my pc and load a solution where i do that.
Binto86
Binto86OP•3y ago
i have deleted everything in debug folder and set the id to IDG_VS_WNDO_OTRWNDWS1, rebuild and i see it under view-> other windows but when i did it again with IDM_VS_CTXT_ITEMNODE i still see it under view-> other windows
AdmSnyder
AdmSnyder•3y ago
i wonder if there aren't examples online.
Binto86
Binto86OP•3y ago
all i found after 30 mins of search was IDM_VS_CTXT_ITEMNODE which doesn't work, even if i rebuild its still under view->other windows
AdmSnyder
AdmSnyder•3y ago
let me have a look...
AdmSnyder
AdmSnyder•3y ago
GitHub
GitHub - microsoft/VSSDK-Extensibility-Samples: Samples for buildin...
Samples for building your own Visual Studio extensions - GitHub - microsoft/VSSDK-Extensibility-Samples: Samples for building your own Visual Studio extensions
Binto86
Binto86OP•3y ago
nope thank you that looks very usefull ii still have a problem with running it it looks like its running some older version of the files when i delete all from debug folder, rebuild etc it still shows the old stuff
AdmSnyder
AdmSnyder•3y ago
sometimes you gotta ++ the version in the vsixmanifest
Binto86
Binto86OP•3y ago
now it looks like it works, but if i try to show it under solution explorer, it doesn't show up, but i guess that i have wrong id, thanks for your help
AdmSnyder
AdmSnyder•3y ago
there's a sample for how to build your own VSS provider in the archived samples... i know that there, solution explorer context menu entries are created - that's where i'd look. i know that, because i used that sample for my vss extension...
Binto86
Binto86OP•3y ago
i have managed to add my command to the context menu, thanks for all your help now i just need to figure out how to show it based on file extension and i can start working on the real extension
AdmSnyder
AdmSnyder•3y ago
what is your extension supposed to do?
Binto86
Binto86OP•3y ago
i wanted to try to do something similar to winforms designer but for blazor i still don't have filter on file extension tho
AdmSnyder
AdmSnyder•3y ago
do you have sketches on how the UI should look? because webforms is a thing and people don't seem to like it...
Binto86
Binto86OP•3y ago
Nope just general idea for now, also i don't care much, even if i should be only person to use it, i want to quickly drag and drop some stuff, to get general idea how it should look and change details in the code @admsnyder my problem is that it looks like any of the code runs after i click the button, so i have no idea how to check for file extension in code, i am trying to do something with the VisibilityConstrains tag in .vsct file, but not successfully ok i got it working to show up only on .razor files! 🥳
Want results from more Discord servers?
Add your server