(Note: This series is used to translate the learnvsxnow series blog posts of inovak on divedeeper. You can find the directories of this series here, or click here to directly access the divedeeper blog)
I am a fan of Visual Studio. Many times, I really want to create some vs plug-ins to help me complete some development work. I have been trying to persuade my colleagues to make their common functions into vs plug-ins. However, when they asked me how to start, I always suggested that they go to the Microsoft SDK and related documents. However, my colleagues frequently asked:
- · I don't have time to read the documents on hundreds of pages.
- · I don't know com, and I don't want to touch it. I want my. Net class.
- · I read the first 50 pages, but I still don't know how to quickly start creating a plug-in.
- · I have read the examples in the SDK, But it seems difficult to create my own package.
I don't think this is their attitude. They can learn about. net, winforms, Asp.net, and WCF. As far as I know, they all have the ability to learn vsx (vs SDK), but they tell me that it is difficult and time-consuming to learn it.
As an MVP, I decided to change the world of vs SDK and vs package. I also belong to people who like. NET development and vs very much, but are not confident in vs SDK. I decided to first learn about Visual Studio extensions and then publish my own learning methods. My goal is to give people who want to learn vs expansion just like me a starting point and unveil its mysteries. All content introduced here is intended for beginners of vsx, so this series is called "learnvsxnow ".
The first thing to do
To use the vs SDK for development, you must install Visual Studio 2008 and Visual Studio 2008 sdks. As an msdn subscriber, you can download and install Visual Studio 2008 Professional Edition (or you can obtain it from other channels ). You can access Visual Studio extended Developer Center (http://msdn.com/vsx) to download Visual Studio 2008 SDK.
How does one implement vs ide extension?
There are many ways to expand Visual Studio (or even Team Foundation server). vs extension is a collective term for these methods. If there is only one way to expand it, Visual Studio will not be a great Microsoft product. For programming, the main method of vs extension is through macros, add-ins, and Visual Studio extension package ).
Macro
We are already familiar with Macros in office products. Like in office, we can also use macros to expand Visual Studio 2008. This is the easiest way to scale vs-we don't even need the vs SDK. Visual Studio provides a function that allows us to record macros. The macro can access the object model of Visual Studio 2008, and can be easily integrated with vs commands, and provides very useful and automated attribute values.
To become a very professional vs macro development engineer, you need to know the object model behind the macro and some methods to use them. Visual Studio provides some examples. The best way is to record some macros and view them.CodeYou can use this code to increase your understanding of macros.
Although macros are great for task automation, they cannot be used to create new functions. In short, macro uses vs IDE's automated interface, but it is not really integrated with. When using macros for development, you must realize that anyone can view yourSource code.
In the learnvsxnow series, I do not intend to involve macro development.
Visual Studio add-ins
Add-ins has more powerful functions to expand Visual Studio, because it can access all object models of Visual Studio 2008 and add new UI elements, for example, tool windows, option pages, menus, and toolbar commands. The added functions look like a part of IDE. Add-ins can also access services provided by IDE itself and other add-in services.
The brand is also guaranteed because the plug-in information is displayed on the Interface displayed when Visual Studio is started or in the "about" dialog box. If you use macros to expand vs, then everyone can see your source code, but an add-in is compiled.ProgramSo you can use some protection techniques to protect your code like other. Net assemblies.
To release the plug-in, you only need to create an installation project and compile the. MSI file. The MSI program will perform all the installation and registration tasks required by your add-in. After installation, you can use the plug-in immediately.
Plug-ins are the easiest way to start with some simple functions. However, in this series, I will not focus on how to develop add-ins. However, the technologies used in add-in for vs package, especially how to use the object model provided by vs IDE, is very useful.
Visual Studio package
Undoubtedly, the vs extension package is the most powerful tool to expand Visual Studio. The most direct evidence is that the function of Visual Studio is built on the extension package with the Visual Studio shell as the core. All the language, editor, debugger, project system, and many other components are package.
From the developer's point of view, adding a new vs package is the same as adding a core function of vs ide to Microsoft. Vs ide does not treat packages developed by Microsoft differently from those developed by third parties.
Package can be used in your favorite languages (C #, VB.. net, C ++) development, so from the perspective of intellectual property protection, they can be like other.. Net Library.
Vs sdkinstall packageinstallation and registration tool, regpkg.exe. Visual Studio uses the so-called PLK (package load key) to check whether an extension package is valid. This PLK can be obtained from the Microsoft site. It is the digital hash code of your package. If your package is deployed in the product environment, its PLK will be checked. (Note: PLK is not required for development and debugging)
This series is mainly for vs package development.
How to start
There are three different expansion methods. There is no doubt that macros are just scratching your head. Add-in and package allow developers to customize the IDE in depth. Therefore, in this series, I mainly develop vs package.
Microsoft said, "to successfully develop vspackage, you must learn InterOP assembly ". This is a very strange saying that it will take us a lot of time. I don't want to say that you must learn InterOP Assembly. I 'd rather say that you must understand the basic concepts behind vs package. So please explore with me: Let's crack the mystery of developing the vs extension package! Don't forget, I am also a newbie in this field, just a few steps ahead of you! This real adventure: I can't draw the entire outline in advance, but only know the following steps. When we reach a milestone, we stop, summarize, and set the next milestone.
Now, our first milestone is to understand what vs package is, how it works, and what elements it contains. We will start from practice: create some simple extension packages and then see what is in it.
In the next article, we will create a "hello World" vs package.
Link: http://dotneteers.net/blogs/divedeeper/archive/2008/01/02/LearnVSXNowPart1.aspx
Http://www.cnblogs.com/walaqi/archive/2009/10/19/1585910.html: