Getting started writing Visual Studio extensions
I’m often asked how to best learn to build Visual Studio extensions, so here is what I wished someone told me before I got started.
Don’t skip the introduction
It’s easy to create a new extensibility project in Visual Studio, but unless you understand the basics of how the extensibility system works, then you are setting yourself up for failure.
The best introduction I know of is a session from //build 2016 and it is as relevant today as it was then.
Know the resources
Where do you get more information about the various aspects of the Visual Studio APIs you wish to use? Here are some very helpful websites that are good to study.
- Official documentation
- Official extensibility samples repo on GitHub
- Visual Studio Extension Checklist
- LearnVSXNow! series by Dotneteers
Know how to search for help
Writing extensions is a bit of a niche activity so searching for help online doesn’t always return relevant results. However, there are ways we can optimize our search terms to generate better results.
- Use the precise interface and class names as part of the search term
- Try adding the words VSIX, VSSDK or Visual Studio to the search terms
- Search directly on GitHub instead of Google/Bing when possible
- Ask questions to other extenders on the Gitter.im chatroom
Use open source as a learning tool
You probably have ideas about what you want your extension to do and how it should work. But what APIs should you use and how do you hook it all up correctly? These are difficult questions and a lot of people give up when these go unanswered.
The best way I know of is to find extensions on the Marketplace that does similar things or uses similar elements as to what you want to do. Then find the source code for that extension and look at what they did and what APIs they used and go from there.
Additional tools
There is an open source extension for Visual Studio that provides additional features for extension authors that I can highly recommend. Grab the Extensibility Tools extension on the Marketplace.
Also, a NuGet package exist containing Roslyn Analyzers that will help you writing extensions. Add the Microsoft.VisualStudio.SDK.Analyzers package to your extension project.
I hope this will give you a better starting point for writing extensions. If I forgot to mention something, please let me know in the comments.
Comments
Comments are closed