New Community Toolkit Leads Extension Writing Revamp for Visual Studio 2022

Microsoft is revamping the extension writing experience for the upcoming Visual Studio 2022 in several ways, including a new extension GitHub repo, Language Server Protocol functionality, an out-of-process extensibility model and a new Visual Studio Community Toolkit.

The latter is described as a community-driven set of project templates, API wrappers and productivity tools designed to provide a simpler, more streamlined extension-writing experience in Visual Studio.

The kit joins others that have been created for various purposes and project types, typically providing collections of helper functions, custom controls and app services designed to simplify and demonstrate common developer tasks for projects of varying types. For example, Microsoft offers the Windows Community Toolkit, MAUI Community Toolkit and a new .NET Community Toolkit.

Microsoft announced the extension-writing revamp in a Sept. 9 blog post titled "The Future of Visual Studio Extensibility is Here!" that included a purported link to the new "Visual Studio Community Toolkit," though it actually brings up a "Get the tools" page for the pre-existing "Visual Studio Extensibility Cookbook" site. Developers use it to cook up extensions with the help of just such an extension itself: the community driven Extensibility Essentials. It's "a collection of extensions that makes it much easier to write Visual Studio extensions" that's described as "a must-have for any extension author." However, the Visual Studio Extensibility Cookbook links to the 2019 package, and its author, VS extension guru Mads Kristensen, has since updated that offering to Extensibility Essentials 2022. A video featuring Kristensen on the site does show him talking about the VS 2022 extensibility pack, though, so just keep in mind that other links on the site may point to the VS 2019 pack.

Extensibility Essentials 2022
[Click on image for larger view.] Extensibility Essentials 2022 (source: Microsoft).

To use Extensibility Essentials 2022, developers must first install the extensibility workload ("Visual Studio extension development") from the VS installer.

isual Studio Extension Development Workload Is a Prerequisite
[Click on image for larger view.] Visual Studio Extension Development Workload Is a Prerequisite (source: Microsoft).

"One of the biggest hurdles to writing a VS extension is that they can be hard to write, especially when you're just starting out," said Leslie Richardson, program manager, Visual Studio Extensibility, in describing the reasoning behind the extensibility pack. "We've heard from authors and aspiring authors that this is due to numerous factors, including hard-to-discover, dated APIs, inconsistent, inaccurate documentation, and lack of best extensibility practices."

But all of the above is just part of the extension-writing overhaul, which also sees the new public VSExtensibility GitHub repo as a home for extensibility developments including announcements, code samples and documentation on preview features. All the resources parked there will be evolved and eventually migrate to official Microsoft documentation as the dev team iterates on its extensibility projects.

Richardson said Microsoft is also now offering extensions to the Language Server Protocol functionalities that help developers leverage capabilities specific to Visual Studio. "Servers can use these additional contracts to provide additional functionalities such as diagnostics info and project contexts when communicating with a Visual Studio instance." The new Visual Studio extensions to the Language Server Protocol come in the NuGet-delivered Microsoft.VisualStudio.LanguageServer.Protocol.Extensions offering.

Yet another part of the extension-writing redo is a new out-of-process extensibility model designed to deal with commonly reported issues such as:

  • Extensions crashing Visual Studio
  • Lack of secure extensions
  • Inconsistent documentation
  • Having to restart Visual Studio when installing extensions

"These are some of the most common frustrations extension users and writers have expressed in the past few years," Richardson said. "Compared to the current model, the new extensibility model loads extensions out-of-process. This allows for more reliable extensions that won't cause Visual Studio to hang or crash. Like the Community Toolkit, this new model will make extensions easier to write with more cohesive APIs and documentation. Also, extensions written with the out-of-proc model let you install them without restarting VS. Last but not least, these extensions can be placed in low-trust environments, protecting your dev machine."

Microsoft claims the new out-of-proc model provides:

  • Increased reliability – Extensions written with the new model are out-of-proc and will not block the Visual Studio UI. This means that if the extension crashes, VS will not crash as a result.
  • Reduced API complexity – The new model's wrapper API has been built from the ground-up to be more cohesive and simpler to implement while retaining the old model's advanced functionality.
  • .NET Core Only – In order to benefit from latest enhancements on .Net and C# the new extensibility model will only support .Net Core 6 and forward. All APIs will also be built on .NET core and will be .NET 6 compatible and extensions will be loaded in a .Net Core host.
  • Hot-loading functionality – Excluding ones requiring VS component prerequisites that haven't been installed yet, extensions written using the new model can be installed and loaded without needing to restart Visual Studio.
  • Cross-CPU Platform – Since underlying implementation is based on RPC compatible brokered services and is .NET core based, all Gladstone extensions will run on all CPU platforms supported by .net core runtime.
  • Low-trust extensions (Coming Soon) – Since extensions in the new model run in a separate process, they can be isolated from devenv and ran in a low-trust sandbox. This environment will provide the extensions with read-only access to the file system and controlled writing access via the model's APIs.

It's a long-term project, however, being rolled out in phases (phase 1 is here), and it's not expected to be fully complete and ready for prime time until late in the VS 2022 release cycle, whatever that means (some are expecting it to ship in Q1 of next year, mirroring VS 2019 timing).

About the Author

David Ramel is an editor and writer for Converge360.

comments powered by Disqus


  • Creating Reactive Applications in .NET

    In modern applications, data is being retrieved in asynchronous, real-time streams, as traditional pull requests where the clients asks for data from the server are becoming a thing of the past.

  • AI for GitHub Collaboration? Maybe Not So Much

    No doubt GitHub Copilot has been a boon for developers, but AI might not be the best tool for collaboration, according to developers weighing in on a recent social media post from the GitHub team.

  • Visual Studio 2022 Getting VS Code 'Command Palette' Equivalent

    As any Visual Studio Code user knows, the editor's command palette is a powerful tool for getting things done quickly, without having to navigate through menus and dialogs. Now, we learn how an equivalent is coming for Microsoft's flagship Visual Studio IDE, invoked by the same familiar Ctrl+Shift+P keyboard shortcut.

  • .NET 9 Preview 3: 'I've Been Waiting 9 Years for This API!'

    Microsoft's third preview of .NET 9 sees a lot of minor tweaks and fixes with no earth-shaking new functionality, but little things can be important to individual developers.

  • Data Anomaly Detection Using a Neural Autoencoder with C#

    Dr. James McCaffrey of Microsoft Research tackles the process of examining a set of source data to find data items that are different in some way from the majority of the source items.

Subscribe on YouTube