Vs extension + nvelocity series (II) -- enable vs to support nvelocity smart prompts (I)

Source: Internet
Author: User
Tags zip extension
I. Basic Concepts

Fortunately, the vs plug-in relies on MEF instead of MAF, which reduces your work. if you have understood the principles of MEF before, you can easily understand the compiling of the vs plug-in. let's take a look at several examples provided by the vs2010 SDK. You can write them skillfully.

However, I would like to briefly introduce the features of MEF. At present, it is sufficient for you to understand these features:

  • Combined container
  • Parts
  • Directory
  • Import and export using features

This is a diagram of the introduction to MEF by the blogger Zhou jingen:

Among them, compositioncontainer is the combination container, and part is the component, while the compositioncontainer of the vs plug-in requires a "directory" (directorycatalog) object to discover these components.

Both import and export are properties. Import declares an object as an import object so that the combined container can use the object marked by it to find objects marked with the same object in the "directory. that is, one definition of MEF: the type of the exportattribute must be the same as that of importattribute.

For more information about MEF, see references in this article.

Ii. vs plug-in principle

Since vs plug-ins are implemented by MEF, when we compile a plug-in, which directory will vs find them?

And then open it with WinRAR. You will find the following content:

The extension. vsixmanifest file tells vs the. NET version it depends on, the referenced content, DLL, and author information.

Sorry, [content_types]. XML does not work.

The other content is what we compile for our SDK project.

So where will the content be stored?

After installing a. vsix file, open the following directory (default path in win7 ):

C: \ Users \ Administrator \ appdata \ Local \ Microsoft \ visualstudio \ 11.0 \ extensions

There are formal folders like Microsoft and folders like 53w4yfez. ZMC.

You need to pay attention to the second type of folder. If you open it all, you will find that there is always a folder which is basically the same as the file of the compressed package you open:

The combined container of vs plug-ins obtains your plug-ins (components) from this directory.

Interesting discoveries

In fact, you will find that the Microsoft product is still very cute. caband. ZIP file. The Office infopath file is also saved. xsn file. There are also a bunch of files. So when you try to study a Microsoft product, try changing it to a zip extension :)

3. Create the "nvelocity compilation plug-in" Project

After installing the SDK for vs2012, when creating a project, you will find that there are more projects:

"Nvelocity writing plug-ins" Require Smart prompts. Unfortunately, there is no template here. Theoretically, vsix project is acceptable, however, there are too few class libraries referenced in this project template. For convenience, select the editor classifer project, because in the following article, we will also add the syntax highlighting function to nvelocity. classifer is exactly what we need.

For more information, see:

Http://www.codeproject.com/Articles/784998/Introduction-Visual-Studio-Editor-Margin-Extension

The blogger said that his translation skills are limited, so he will not help everyone ..

Iv. Summary

Now we have completed the preparation and basic concepts for creating the "nvelocity compilation plug-in. This blogger prefers to focus on code and concepts when talking about concepts. In the next chapter, we will feel the nvelocity coding plug-in for a long time. I was a normal teacher. I didn't choose to be a teacher because of my eloquence and a programmer's dream. I only wrote a few blog posts. I don't know too much about the mistakes. Please look at Hai Han, something wrong... You beat me!

V. References

Use the managed scalability framework in. Net 4 to build applications that can be combined

Getting started with Visual Studio editor margin extensions

Managed extensibility framework (MEF)

Codeplex, Microsoft. Composition documentation

Introduction to the MEF (managed extensibility framework) architecture under. net4

Msdn: extending the editor

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.