locked
Questions about creating Visual Studio extension RRS feed

  • Question

  • I have created a small source code analyses tool for C/C++. I have the core of the program as a .dll file which is completely written in C++, and also have it as a console application.

    But I want to create a Visual Studio Extension for my tool. What I want to have is,  when my extension is installed, I want it to create an entry and icon for my tool under the Tools section in Visual Studio. If a C/C++ source code is open in Visual Studio and if someone presses that button about my tool (which will be under Tools section), it should analyze the code and post the security regarding problems of the code in the output section in the Visual Studio.

    On the other hand, I also want it to work with a right-click, what I mean with it is that if someone has a C/C++ project, and wants to analyze a single source file in the project, should just right-click it and should see my tool along with all the classic visual studio options, and should be able to active it from there. Also if someone wants to analyze the whole project at once, he/she should right-click to the project and choose my tool and run the analyses from there. So people should not always go to Tools -> MyTool.

    I know that it is hard for you to tell me anything without having my source code, but if you could help me, I would be glad. Please note that I'm targeting Visual Studio 2010 and 2012. I don't have much knowledge with Visual Studio and Extensions, therefore I need help.


    • Edited by et- Saturday, December 22, 2012 6:16 PM
    Saturday, December 22, 2012 6:13 PM

Answers

  • Your best bet would be to use C# for your VS integration. You can integrate via C++ but there are no wizards that make it easier and I doubt there are any up-to-date walkthroughs on how to do it manually, since pretty much no one uses C++ for this anymore.

    Your basic approach in C# would be to install the VS SDK, use the File->New Project dialog to create a VS Package. You would use VSCT to add your commands + command handlers, you would, on execution of your command, invoke your stand alone dll (you can use pInvoke to call into C-style entry points exposed from your C++ dll). You would interpret the tool's output and pass it along to the output window or perhaps the error list. More specific information can be given but it would need to be in result of more specific questions (like how do I do X, where X is specific question about a specific piece of what you are trying to do).

    Ryan

    • Proposed as answer by Ego Jiang Thursday, December 27, 2012 5:37 AM
    • Marked as answer by Ego Jiang Monday, December 31, 2012 5:42 AM
    Saturday, December 22, 2012 6:33 PM