Question

I have a winforms project which generates batch scripts given a specific xml file. I want to create a VS extension for this Winforms project so that I can do something like a right-click on the xml file or select the xml file and go to the Tools menu and select the extension and the scripts get auto-generated for me, instead of having to have this winforms installed, I would like to have it as an extension.

I'm totally new to VS extensions, I looked through some posts and blogs but could not really find a proper direction. Can someone guide me through with some links and/or examples.

P.S. A possible duplicate : Visual Studio Extensibility Resources

But it did not help me. :(

Thanks

Was it helpful?

Solution

I figured this out. You need to add CommandBar to a CommandBars collection in your code and map it to the key "Item' if you want it to work for a single file. Do this in the OnConnected() method.

 CommandBars cmdBars = (CommandBars)(_applicationObject.CommandBars);

 CommandBar vsBarItem = cmdBars["Item"];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top