Writing extensions just got easier
In collaboration with the open source community, we’re introducing a new toolkit for writing Visual Studio extensions. Extensions used to be difficult to write, but the new toolkit makes it easier than ever. The toolkit consists of brand-new tooling inside Visual Studio as well as new APIs to code against. It’s all included in the free Extensibility Essentials extension.
The community of Visual extenders are in a unique position to help create the tooling inside Visual Studio that they themselves would like to use. This toolkit is made by the community – for the community.
Getting started
The best way to getting started with the toolkit is to visit the VSIX Cookbook. It’s a website with guides, documentation, and recipes designed to help jump start extension development. It’s for beginners and advanced extenders alike. For short video walkthroughs on a bunch of extensibility topics using the toolkit, head on over to the VS Fundamentals: Extensions playlist.
It would be cool if…
Ok, so we made it easier to get started, but where do you get ideas for what extensions to write? When I’m out of ideas, I often browse through the open feature requests logged by Visual Studio users. That’s my favorite go-to place for inspiration and I always find ideas I can use. My test is that if the idea can successfully finish the sentence: It would be cool if…, then it’s a good one.
Happy coding!
15 comments
Hi Mads, first of all I want to say thank you for the great job and support to VSIX development community!
I have some libraries for code generation using Roslyn APIs in .Net 5.0.
Now I’m trying to include them into an extension using VS2022 but it still using VSIX Project template with .Net Framework 4.8.
Is it in the Microsoft roadmap to update the VSIX templates to 5.0 soon?
Currently the only option that I see is to downgrade my libraries to 4.8 but it is not sweet at all.
I will appreciate any suggestion in this way.
Thanks a lot!
Visual Studio 2022 itself is running on .NET Framework 4.8 and any extension running in-proc will run in the same .NET runtime version. The only way to add a .NET 5 component to your extension is to execute it out-of-proc.
Thanks a lot Mads.
I just watched your tutorial on vs youtube channel. It’s so amazing! Thank you so much for improving the dev experience.
Hello Mads, thanks for all the extensions and tools, and also for your passion for teach to the rest of us the process of make a good VSIX project.
Now, I accept I’m hungry for more…then I wish to suggest you an episode about how to write an extension for text code highlighting.
Thanks again for your great job and a “gran saludo” from Rosario, Argentina!
I’m so glad someone else asked about this! I’ve a home-grown ORM tool that uses files with a basic syntax I originally came up with so long ago that JSON didn’t exist yet, and I’ve always wanted to figure out how to add syntax highlighting and intellisense for it. It’ll be a vanity project at this point, because the last real customer of that codebase is in the process of migrating off it, but I’d still love to see if I can actually do it.
Saludos desde República Dominicana, Enrique!
I believe the new APIs are a work in progress, so for certain things you’d still need to learn to use the old APIs.
A long time ago I tried to make one and found some alternatives I could readily use instead of making my own. But if you’re still interested you can look at the code of these three extensions:
Semantic Syntax Colorizer: https://github.com/hicknhack-software/semantic-colorizer
CoCo: https://github.com/GeorgeAlexandria/CoCo
Color Coder: https://github.com/HamidMosalla/VisualStudio-ColorCoder
Let me know if you need additional help.
Hola Jefry! And thanks for your response!
Yes, I’ll start by looking at the links you share with us.
Right now, using VS2022 CE, the only “gap” in syntax highlight (in my own experience) was the VUE html template between script tags (I use it in the razor view, not in separate .vue files). In VS19 CE the same template is highlighted OK… That is the only reason right now for think about write such extension, but it’s not an easy work and, sincerelly, I can live without it…
Thanks again to you and Mr Kristensen
Hi Mads. Do you have plans to fix bugs in your BlueColorTheme extension?
I don’t plan on it since there is no way for me to easily port the missing colors to the new features in VS 2019 (it was originally the 2017 theme). If anyone wants to attempt the effort and send a PR, I’d be happy to merge it.
The new Cookbook documentation is a great start. But when a topic is not covered, it’s difficult to know where to go to look for help.
For example, I’m porting a fairly simple extension to VS2022, so I decided to try the new Community.VisualStudio.Toolkit APIs. I need to do something fairly simple: fetch the current solution configuration and platform. My previous code looked like this:
var activeConfig = dte_.Solution.Properties.Item(“ActiveConfig”).Value.ToString(); // Will be, e.g., “Debug|x64”
It’s unclear how to do this with the new APIs. VS.Solutions.GetCurrentSolutionAsync gets a SolutionItem object, but there are no properties to query.
Can you recommend a place where folks can get their questions about the new APIs answered?
We want to make the Community Toolkit a great replacement for the DTE. Please open an issue on missing features so we can add them
You can go to the Q&A site for Visual Studio Extension Development (https://docs.microsoft.com/en-us/answers/topics/vs-extensions.html).
It seems the new APIs Kristensen refers to are based on the Visual Studio Community Toolkit (https://github.com/VsixCommunity/Community.VisualStudio.Toolkit) and there isn’t something like that yet. It’s a good chance to make a PR to add those APIs, but you’d have to use the old and difficult to find APIs of the VSSDK.
Thank you Mads for creating all those handy VSIX dev related plugins, VsixCommunity project and ton of educational content for VSIX developers. 🥳
When I had first entered VSIX development about 2015 I used MSDN, Stackoverflow and MS Forums. It was hard to get going. It was like dark ages compared to renaissance that we have today thanks to your hard work and dedication 🙏. I hope Visual Studio management team is aware of how much you have done to popularize Visual Studio plugins development.
Thank you for the kind words, Piotr. This has been a passion-driven exercise that will continue for years to come, I hope.