VisualStudio.Extensibility: Install extensions without restarting Visual Studio!

Maia Kelner

The new VisualStudio.Extensibility SDK helps you build extensions that run outside of the main IDE process for improved performance and reliability. With a focus on developer productivity, it features a modern, intuitive .NET Core-based API and solid, well-maintained documentation.

This public preview release builds on our previous developer previews, and it brings with it the highly-requested ability to publish your new extensions in the Visual Studio Marketplace and share them with customers. We’ve introduced some great new features that will make it easier to configure your extensions, query the project system, and create powerful debugger visualizers. Also with this release, we’ve strengthened our plans to keep our core API stable across releases, and we’ve explicitly marked APIs that may change to help developers create extensions with confidence.

Please visit https://aka.ms/VisualStudio.Extensibility for up-to-date docs and installation instructions. If you’d like to report bugs or suggest features, please use the issue tracker on our GitHub repo, where you can also find extension samples to help you get started.

 

What’s new for VisualStudio.Extensibility?

This release of VisualStudio.Extensibility expands your ability to create powerful productivity extensions, with features including:

 

Publish your extensions in the Visual Studio Marketplace

With customer downloads in the millions, the Visual Studio Marketplace is the best place to share and find amazing Visual Studio extensions. Starting with this release of VisualStudio.Extensibility, you can now publish your extensions in the Visual Studio Marketplace!

A screenshot of the Visual Studio Marketplace with the "Publish Extensions" link surrounded by a red box.

Building a VisualStudio.Extensibility-based extension in Visual Studio now produces a standalone VSIX package. You can share your VSIX locally to enable others from your team or organization to install it directly, and you can also publish it in the Marketplace to reach the largest audience of Visual Studio users.

We can’t wait to see your new extensions on the Marketplace!

 

Hot loading: Install extensions without restarting Visual Studio

With VisualStudio.Extensibility, you can finally install new extensions without closing and restarting Visual Studio! This has been one of the most requested features by users, and we’re excited to deliver it! For example, suppose you’re having some trouble debugging a complex regular expression. You can go to the Marketplace using the Extension Manager to find and install our new VisualStudio.Extensibility-based Regex Match Debugger Visualizer, and start using it immediately to nail your regex.

This streamlined installation, called hot loading, works for any out-of-process extensions written using VisualStudio.Extensibility. We’re also working to add a visual indicator to extensions in the Marketplace that support hot loading to make it easy for you to identify. We’ll share updates as we have them!

Extensions are installed alongside your Visual Studio installation by the Visual Studio installer, which will be a familiar process to all of you who take advantage of our exciting new support for installing extensions automatically using a .vsconfig file when you set up a new machine or Visual Studio installation. Users who don’t have admin permissions can take advantage of our AlllowStandardUserControl policy to help with extension installation.

 

Configure your extension easily with configuration properties

Building on our configuration properties for extension components like commands, you can now configure your extensions directly in code. With strongly-typed classes and properties, you can use IntelliSense to quickly find and fill in the required and optional values for configuring an extension.

Before, you needed to manually maintain a separate VSIX manifest file, but with the improvements in the latest release, extension configuration is done seamlessly inside your source code:

public override ExtensionConfiguration ExtensionConfiguration => new()
  {
      Metadata = new(id: "MyExtension.ae8b86e5", version:this.ExtensionAssemblyVersion,
          publisherName:"My Publisher", displayName:"My Extension")
      {
          Description = "A VisualStudio.Extensibility extension to demonstrate configuration properties.",
          License = "LICENSE.txt",
          Icon = "icon.png",
          PreviewImage = "previewImage.png",
          Tags = new[] {"Build", "Productivity", "C#"},
          MoreInfo = "https://aka.ms/VisualStudio.Extensibility"
      }
  };

Sample code for configuring an extension

Together, configuration properties not only allow you to control how parts of your extension, like commands, behave, but also how your extension itself gets activated by Visual Studio. When you build your project, Visual Studio will use this configuration to create a VSIX for your extension, which you can share or publish to the Marketplace.

 

Create dockable custom data visualizers for better debugging

Debugger visualizers enable you to provide Visual Studio users with clear, insightful visualizations of complex data types to help improve their debugging workflows. With VisualStudio.Extensibility, you can now create non-modal/dockable debugger visualizers in tool windows that you can dock or float around the IDE.

For example, here’s our Regex Match Debugger Visualizer docked with the other debugging tool windows:

A screenshot of the Regex Match Debugger Visualizer docked with the other debugging tool windows.

Together with the modal debugger visualizers from the previous release, you now have the flexibility to design powerful visualizers for any debugging scenario! To learn more about debugger visualizers, please visit the debugger visualizer documentation. To find code samples, visit our samples repo.

 

Add Language Server Protocol (LSP) support to your extension

Beginning with this version of VisualStudio.Extensibility, you’ll be able to begin integrating LSP into your extensions. With this support, you can create a language server provider, and use it to activate and interact with a language server.

Language server providers also support configuration properties, which can be used to control which file types the language server applies to. For example:

public override LanguageServerProviderConfiguration LanguageServerProviderConfiguration => new(
      "%RustLspExtension.RustLanguageServerProvider.DisplayName%",
      new[] 
      { 
          DocumentFilter.FromDocumentType(RustDocumentType) 
      });

Sample code for creating a language server provider

We’ve added a sample to our samples repo that creates a language server provider for Rust, and uses that it to power IntelliSense and tooltips when you open a Rust file.

VisualStudio.Extensibility and LSP together is a powerful integration, and we need your help. Please experiment with your own language servers and send feedback about which additional features you require for your extension.

 

Query the project system with the enhanced query API

With the previous release, we added support for querying the project system, which you could use to search for projects that met certain criteria or to modify projects. This release adds many additional features, including:

  • New project actions:

    • Build
    • Reload/Unload
    • Rename
    • Save
  • New solution actions:

    • Create/remove solution configurations
  • Folders and startup projects:

    • Query for information
    • Create/remove

For example, here’s how you could use the API to build a specific project:

var result = await this.Extensibility.Workspaces().QueryProjectsAsync(
      project => project.Where(p => p.Name == projectName),
      cancellationToken);
await result.First().BuildAsync(cancellationToken);

Sample code for building a specific project

And here’s how you can create a new solution configuration programmatically:

await this.Extensibility.Workspaces().UpdateSolutionAsync(
      solution => solution.Where(solution => solution.BaseName == solutionName),
      solution => solution.AddSolutionConfiguration("Foo", "Debug", false),
      cancellationToken);

Sample code for creating a new solution configuration

Please give these new features a try and let us know which other project system capabilities you need for your extensions!

 

We can’t do this without you!

We need your help as we continue to develop VisualStudio.Extensibility! Please try out this preview release and let us know what you think. Check out the docs, browse the code samples, and build your first extension. You can send feedback, report issues, or request features through our issue tracker.

We’re prioritizing the features that our extenders ask for, so please give VisualStudio.Extensibility a try and share your thoughts with us!

 

Take Our Survey

Please help us design the best extensibility experience for Visual Studio by taking our survey here! We’re using the data to help identify what’s working and what we can improve. Whether you’re an extension author or an extension user, please let us know what you think!

Take the survey here!

13 comments

Discussion is closed. Login to edit/delete existing comments.

  • Rand Random 0

    Disclaimer: I am NOT a developer of extensions, so the following question may sound silly.

    With this new extension model, is it possible to write ONE extension for both Visual Studio and Visual Studio Code?

    (or at the very least share a lot of code between two extensions)

    • Maia KelnerMicrosoft employee 1

      Thanks for the question! Visual Studio and Visual Studio Code have different product architectures and so they have different extension models, but with this new SDK, it’s possible to share significant code across extensions for each platform. For example, this release adds support for language servers/LSP, so if you use a language server, it can be shared across Visual Studio and Visual Studio Code extensions.

  • Martin Sedlmair 0

    Can I put the extension in my repo so that the extension is versioned with the state of my repo?

    • Maia KelnerMicrosoft employee 1

      Thanks for the question, Martin! I want to make sure I understand the question properly; could you please give some more details about the scenario and the desired behavior?

  • Calvin Allen 0

    So close to perfection! Remove the document handler for initializing an LSP and let me do it manually like VSCode, and I can die happy

    • Maia KelnerMicrosoft employee 1

      Thanks for the feedback, Calvin! The LSP APIs are marked as experimental exactly because we’re hoping for user feedback to help us shape the final design. Please consider creating a suggestion ticket at https://developercommunity.visualstudio.com/VisualStudio/suggest with some more details about the design and features you’re hoping to see, and I’ll bring it to the engineering team for consideration in future versions!

      • Stuart Ballard 1

        I’ve long wanted to add syntax highlighting in VS for a little toy language I wrote, and it seems like LSP is the way to do this, but all the examples and “getting started” guides I’ve found about LSPs seem to be geared towards situations where you already have an LSP you’re trying to use, either directly or as a starting point. Do you know of any resources for getting started on writing an LSP from scratch, or at least for a language that’s its own syntax and not particularly similar to anything that has an existing LSP?

  • Paulo Pinto 0

    Good news, and quite happy to see some .NET love, with zero references to COM.

    • Maia KelnerMicrosoft employee 1

      Thanks Paulo! We’re excited to bring Visual Studio extensions into the modern era by embracing those newer, nicer .NET core versions!

  • Daniel Smith 0

    This is fantastic news! Modernizing the APIs to .NET Core and being able to install extensions without restating are top requests, and the team has certainly delivered.

    Are .NET Core extensions the first steps towards a possible future version of Visual Studio that is also .NET Core based?

    • Maia KelnerMicrosoft employee 1

      Thanks very much for the feedback, Daniel! Please let us know if you have any other top requests for working with extensions.

      We don’t have any news to share on the possibility of a future version of Visual Studio running on .NET Core at this time, but we’ll share updates as soon as we have them.

  • Rodrigo Luna 0

    This is a very, very welcome development. Thank you.

    • Maia KelnerMicrosoft employee 1

      Thanks Rodrigo! We appreciate your feedback!

Feedback usabilla icon