Browse DevX
Sign up for e-mail newsletters from DevX


Deconstructing Add-In Architecture in Visual Studio .NET : Page 2

The Visual Studio .NET extensibility model included with the IDE allows any developer to design and compile value-adding custom add-ins right out-of-the-box. No additional APIs or tools are required. Visual Studio .NET even provides a starting point for add-in developers with the Visual Studio .NET Add-In Project type.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

A Brief Comparison to Macros
Figure 1: The Visual Studio macro server process, vsmsvr.exe, handles the execution of macros outside of the IDE process, devenv.exe
Before jumping into the guts of what an add-in entails, or how the architecture of the IDE interacts with these special classes, let me explain the relationship that macros and add-ins have to one another. Macros play a special role by providing the developer with a quick and simple mechanism for defining custom behavior and functionality. Macros allow the development of custom functionality, but carry significant limits in terms of deployment, performance, and functionality constraints. Both fundamentally use the same extensibility API, EnvDTE, to perform all of their fancy footwork. Similarities tend to end there. For example, the language used to write macros within the IDE is limited to Visual Basic .NET. Since macros tend to exist to perform simpler, more straight-forward tasks of an automation nature within the IDE, using Visual Basic .NET as the macro language provides a more natural fit. This approach mirrors the "Great for simplicity" strategy, but consequently falls short of providing an ideal situation for the predominantly C# developer. VS .NET saves macros in files with a .vsmacros extension, while add-ins are .NET classes compiled into DLL assemblies. Compiling add-ins into assemblies highlights a fundamental difference: macros run out-of-process with the IDE, while a DLL containing an add-in class achieves better performance by running within the IDE. Macros run within a vsmsvr.exeprocess, in comparison to the IDE, or devenv.exe. You can see this in Figure 1 where I recorded and then ran a macro while I had the Task Manager open. Compiling add-ins into assemblies also provides a layer of intellectual property protection (security) that is not afforded to macros, which are essentially distributed along with their source code.

Thanks for your registration, follow us on our social networks to keep up-to-date