Objective
In the VS overview, we briefly review the history of vs. This article will illustrate the development of macro and add-in with two simple examples. By macro us to record some of the duplicates in VS, we can run them multiple times to save time and maintain a good mood; through add-in, we can add new functionality to vs by ourselves, extending vs means expanding ourselves.
VS 2008 expanded Way at a glance
There are three main ways to expand vs in the previous vs Overview: Macro, Add-in, and VSPackage. In fact, there are a lot more options, and here's a simple list:
Macro
Add-in
VSPackage
VS Shell
Domain specific Language Tool
Visualizer
Code Snippet
Project/item Template
Msbuild
Even External tools (menu Tools->external tools) can also be viewed as an extension, and we can add external tools to the VS menu, which makes it easier to use. Previously written essays on Vs and Code snippet, they belong to a simpler way of extending.
In this article will be a brief introduction to the use of macro and add-in, they can access the common API, in this case, to understand the macro of add-in development can also help, and then officially into the add-in development. After that, you will try to introduce a little more to other extensions.
Develop the first macro
As programmers, we're afraid of repetition when we write code, and everyone knows it's harmful. On the other hand, for some operations, it can be tiresome to repeat them frequently, and macro may be able to help at this time.
Macro is generally translated as a macro, and one of its meanings is "heavily used", a word that should be familiar to developers under our Windows platform, both in Word and Excel. The role of a macro is to record some of our duplicates in VS, and then run it multiple times, which can save a lot of time and feel better.
In VS, macros can be created in two ways, one for recording and the other for hand-written code. As you can imagine, the first approach is simpler, and the second is more flexible and powerful. Note that you can only use vb.net to develop macros at this moment.
I used to have developed simple Excel automation with VBA, then if some of the operations do not know how to express in code, then record a macro to see the code generated by it. The macros in VS are similar to this, which is why I say it also helps with add-in development. We can combine the two previous approaches and look at the following examples.
1) Macro Explorer
Open Alt+f8 Explorer via menu tools-> Macros-> Macro Explorer (shortcut key Macro):