📜 ⬆️ ⬇️

Extend Visual Studio functionality

Disklamer

Immediately make a reservation. Everything written here is exclusively my IMHO . I can be wrong and I will be glad if you correct me :)

I will use slang and barbarism because I write in Russian, but there are no Russian analogues of the necessary terms or they do not exactly convey the meaning.
')
Okay, to the point.

This article has the task, in a first approximation, to inform those interested in the possibilities of expanding the functionality of Visual Studio - the “technology” of Visual Studio Extensibility.

Visual Studio Extensibility


As you know, Microsoft Visual Studio is a development environment ( IDE ). And an expandable environment.

Due to the fact that the environment is not simple, has a long history and allows you to implement serious things on its basis, the term Visual Studio Extensibility ( VSX ) appeared, which combines everything that relates to the extension of the studio's functionality (I will call it that).

The studio has a ten-year history. It was created in COM- time (I know that they did not pass) for COM-development. Then I changed my main purpose to .NET development. But the COM-based-application remained, so the main extensibility is directly related to its COM-nature. For it, extensibility, .NET-and COM-interoperability is used. This undoubtedly adds to the process of expansion fascination and a certain charm (a small proportion of sarcasm).

The studio core from version to version remains basically the same as that of the 2002 version, and most of the new features (VS2005, VS2008 and VS2010) are implemented using the power of VSX.

Unfortunately, the developer who will work with VSX will have to face the “charming code” that has been developed over the course of several years by different people and has been reworked many times. And if we take into account the nature of the studio and, perhaps, the shortest possible time to develop it, you can imagine how much interesting and surprising the developer can see. Unfortunately, the naming of entities is also somewhat lame.

And finally, such an aspect as the presence of extensive and understandable documentation, or rather its absence, gives rise to an incomprehensible and magical attraction to the use of VSX by professional developers. What could be more interesting than the study of already implemented solutions and the invention of new ones based on them?

Why expand the studio?


Actually, why would we need an extension studio? If you think about it, you can find a lot of solutions based on VSX, which we (I mean dotnetchikov) use in everyday life. WPF , Silverlight and XAML , WCF , LINQ , Tools for Office , Crystal Reports , Workflow Foundation , test projects — MS's development, which was not available in earlier studio versions, but then appeared thanks to progress. Next is VSX itself, which, it turns out, is based on itself and includes the Integration package, DSL Tools, and other things. Known ReSharper , AnkhSVN , XMLSpy and GhostDoc . Perhaps less well-known CodeRush , TestDriven.NET , Smart Paster . Non-basic for .NET languages F # , IronPython , IronRuby , PHP. These are all things to some extent based on VSX.

Immediately worth noting: the extension studio is available in two versions - Isolated Mode and Integrated Mode. The difference here is that the core of the studio itself and its API is always available, but the functionality that is present in a regular studio will only be available in integrated mode (for example, sisharp and visual-basic, web projects, all kinds of windows and tools). In an isolated we get only the shell, shell.

XNA Game Studio , Microsoft Robotics Studio , SQL Server Management Studio , Microsoft Visual Studio Macros - the first products that came to mind, implemented on the basis of an isolated shell. Also, the whole line of express studios: Visual Basic 2008 Express Edition, Visual Web Developer 2008 Express Edition, Visual C ++ 2008 Express Edition, Visual C # 2008 Express Edition , I think has the same roots.

On Habré, by the way, there were publications about examples of using VSX:
Now, I hope, a little more clear why expand the studio. It seems to me that VSX is a useful thing, especially considering that he himself is developing. New Visual Studio 2010 should be more friendly to those who are planning to do the extension. At least, due to the fact that .NET Framework 4.0 will include a Managed Extensibility Framework (as recalled by the hablauser Vladek ).

It is important to note that extensions in integrated mode are available only in non-express versions. That is, in free versions it is impossible to install any extensions. But this integrated mode can be used to create and implement new programming languages, additional development tools in an already acquired and installed studio. Examples of languages ​​and technologies were higher.

If we want to do without purchasing an expensive copy of Visual Studio Standard, Professional, or the Team System version, then especially for us there is a free Visual Studio Isolated Shell, which you can use to create your standalon products, such as specific editors.

VSX features


The expansion options for the 2008 version , as well as the 2005 version , included three main options:
As far as I understand, the 2010th studio and the new SDK have not yet brought anything else to this list.

Let's go back to the extensions. Macros and add-ins are always available, but creating packages requires the presence of a Visual Studio SDK .

In order to get the full benefit of the VS SDK, it is better to first install VS 2008 SDK 1.0 , and only then VS 2008 SDK 1.1 . In 1.1, for some reason, there is no Project Base, which will be discussed later.

In general, after installing the VS SDK, it will be possible to create add-ins and packages, and after installing Visual Studio 2008 Shell (SPID) with SP1 , VS Shell-based solutions. I will note that the isolated shell exists in ten localizations.

Only three options VSX limited only technically. And so, there are also visualizers (Visualizers), windows (Tool Window), projects (Project Templates), MSBuild extensions, DSL Tools and the already mentioned VS Shell Isolated.

Now in order:

MPF


The basis of VSX is the Managed Package Framework (MPF). It allows you to create packages with managed code. The MPF contains encapsulated implementations of a variety of PACE interfaces, which allows you to get by with less code to create your own PEDEX.

MPF namespaces


The following list of namespaces becomes available after installing the SDK:
NamespaceDescription
Microsoft.VisualStudioClasses for working with COM errors, studio constants and win32 windows
Microsoft.VisualStudio.PackageManaged Code Wrappers for Studio Projects, Code Editors, and MSBuild
Microsoft.VisualStudio.Package.AutomationWrappers for automation objects
Microsoft.VisualStudio.ShellBase MPF classes that implement many of the main studio objects from which to inherit
Microsoft.VisualStudio.Shell.DesignDesigner Extensions
Microsoft.VisualStudio.Shell.Design.SerializationDesigner serialization extensions
Microsoft.VisualStudio.Shell.Design.Serialization.CodeDomCodeDOM extensions designers
Microsoft.VisualStudio.Shell.FlavorProject Subtype Support

VSXtra


According to the creator of this toolkit ( VSXtra ), the development of the package has become much easier than it was. By using a lot of wrappers, other patterns and other things, he made an effort to hide the COM-nature of the studio and the developer's “schizophrenic state” required to work with COM through .NET.

Problems solved by VSXtra:
In general, he wrapped the MPF, having realized what was necessary, which it did not realize, and this wrapper is quite modern and harmonious.

The main task of this product is to push the development team of the studio to create a new modern MPF. Well, the side - to help developers and entertain its author.

Visual Studio 2010 SDK


The Visual Studio 2010 SDK contains several new elements that simplify the development of extensions:
What changed:
The Visual Studio 2010 SDK makes it possible to implement several new types of extensions in addition to the previous version:

Using peckheads and MEF to empower studio


The studio editor is based on a package, supplemented by several MEF extensions. To extend the functionality of the editor, you can create these extensions yourself.

The Visual Studio SDK includes tools and documentation that helps you create packages and MEF extensions using C #, Visual Basic or Visual C ++ .

Additional Information: Getting Started with the Visual Studio Integration SDK , Developing the Visual Studio Extensions .

Expansion of data designer functionality for working with external sources


Extending the capabilities of the data designer (Data Designer Extensibility, DDEX) allows you to work with many external data sources in design mode. The hierarchies of these sources are displayed in the server explorer (Server Explorer). DDEX makes it possible to get drag-n-drop functionality in relation to external data sources, to work with the visibility of properties and other features of studio designers.

The DDEX SDK provides documentation, examples, and other information to help create your own DDEX providers.

Additional Information: Data Designer Extensibility Architecture , Data Designer Extensibility (DDEX) SDK .

Integration with version control systems


The studio supports two types of integration: a plug-in created on the basis of the corresponding API (Source Control Plug-in API, formerly known as MSSCCI API), and providing basic functionality; Peckege based solution with more features.

Additional information: Source Control Integration Overview , Creating a Source Control Plug-in , Creating a Source Control VSPackage .

Customizing or creating debuggers


The SDK allows you to customize studio components for debugging or to create your own components for integration into the IDE.

In the studio, debugging takes place outside the process of the application being debugged. Now you can create your own components that interact with the debugger, but do not affect the application being debugged.

To use the Visual Studio Debugging SDK, you need to understand:Additional Information: Getting Started with Debugger Extensibility .

Creating Testing Tools


The studio includes testing tools that are deeply integrated with other environmental features. The toolkit works not only with its own testing framework, but also with the software life cycle toolkit.

These tools allow you to create, manage, edit, and run manual and automated tests, saving test results. It is possible to create your own test types.

Additional information: Testing the Application , Customizing for Testing By Using the Visual Studio SDK .

Source: https://habr.com/ru/post/74883/


All Articles