Introduction
Usually, frequently used code is most easily accessed via a DLL library. That being said, I have had many situations where I only need a single method or class from a large DLL. I was often hunting and searching many different projects for a certain piece of code, often not sure where I used it last. This Add-In stores snippets in an Access database, and uses a VS.NET Control Bar to facilitate access to these snippets.
Using the Add-In
- Close any instances of Visual Studio .NET that you have been running.
- Download and run the demo project, which is actually the MSI setup for the Add-In.
- Open Visual Studio .NET.
When you open VS.NET, you will have a new toolbar in the corner of your screen that you can drag onto the VS.NET menu bar. Once the toolbar is dropped onto VS, there will be a single action button that will control all the actions of CodeDepot:
Clicking this icon will open the ComboBox menu for CodeDepot. There are three static entries in the ComboBox.
- [Collapse MenuBar]
- [Open CodeDepot Manager]
- [Reload Snippets]
Snippets can be added via the CodeDepot Manager, and by a new menu item in the VS context menu. Just highlight the snippet you want to add and right click. Select the Add Snippet menu item:
Once snippets have been added, you can access them through the ComboBox drop menu, the action button must be clicked to load the snippet or perform the static action selected from the ComboBox. Once the snippet is loaded, all you need to do is paste it into your project.
Note: I attempted to handle the SelectionChanged
event of the ComboBox to avoid the multiple button clicks, but was unsuccessful. I'd welcome any suggestions to improve this interface.
Updates
Due to popular demand, I've added MS SQL Server support. The Code Manager now has a Settings tab at the top which allows the user to specify the path to the local database or use a network SQL Server.
The SQL credentials you provide must have owner rights to the SQL Catalog you specify, since the CodeDepot table will be created automatically. You can also switch between databases (local and SQL) at will.
Conclusion
I hope others find this Add-In as useful as I have, and since this is my first VS.NET Add-In, I welcome any suggestions on improving the UI or performance.