I. Function Description
The project contains a appsettings. xml file. When a new element is added to the file, the added content is automatically synchronized to the appsettings. xml file in other directories.
2. Plug-In Template Selection
To develop the vs plug-in, you need to install the SDK. After installation, select the plug-in template to be used under the new project> visal C #> extensibility. Because this function is related to text editing, select the editor text adornment template or select another template for development. The following is an example of two plug-ins: Visual Studio text editor extension and building and publishing an extension for Visual Studio 2010.
3. How to monitor the Save events in the editing window
You can use serviceprovider. globalprovider. getservice (type) method to obtain the DTE object. To obtain this object, you must add envdte and Microsoft. visual Studio. shell.12.0 assembly, which references Microsoft. visual Studio. you also need to add other Assembly dependent on the shell.12.0 Assembly. During compilation, you can know which Assembly needs to be added. After obtaining the DTE object, you can subscribe to the documentsaved event of the deletevemts object. Note: You must define the DTE, events, and incluentevents objects as global variables. Otherwise, the defined events will not take effect because of the garbage collection mechanism of C.
This is a tutorial on getting DTE objects and subscribing to documentsaved events: Walkthrough: accessing the DTE object from an editor extension, vsix tutorial-Visual Studio events and commands
4. The modal dialog box is displayed in the plug-in.
Modal Dialog Boxes for Visual Studio extensions this is a tutorial on how to bring up a modal window on msdn. You can also use the winform window directly. In the plug-in I developed, winform is used directly.
5. How to add an option page in tools> options under the editor Template
In the Visual Studio package template, you can easily add the option page. This is an article on msdn about adding the option page: Creating an options page. However, it will be a little more troublesome in the editor template.
Can I add an options menu to my vsix extension without adding a vspackage? This is a question on stackoverflow about how to add an option page under a non-package template. To add the <vspackage> | % currentproject % | </vspackage> element to the source. extension. vsixmanifest file of the project, add the element as shown in
In addition, you need to modify the csproj file and change the generatepkgdeffile and copybuildoutputtooutputdirectory elements to true. If the csproj file does not contain these two elements, add them. Pay special attention to the last point, the includeassemblyinvsixcontainer element must be added to the preceding two elements, otherwise the option page will not be displayed. Now you can add the option page.
6. How to Deal with this property page loading?
After step 5, the option page can be displayed in tools> options, but the error "error occurred when loading this property page" may occur. In this case, you need to go to source. extension. two options to continue adding the vsixmanifest File
So far, the above are the problems and solutions I encountered during the development of the vs plug-in. I hope the above will be helpful to those who want to develop the vs plug-in.
Vs2013 plug-in development