Before we dive into the API, let’s briefly discuss the tools you need to actually develop R# plug-ins. Basically, you need the following:
- Visual Studio is a fairly obvious requirement, though strictly speaking the plug-ins themselves can be developed using any IDE that supports CLR languages.
- ReSharper --- if you are writing add-ins for youself, use the version you have, but please note that the SDK is only available from v6.1 onwards). If you’re making something commercial, you’ll need to fire up your test rig and set up remote debugging for the machines you want to try it on. If you don’t have that many machines, use virtual machines instead. Whatever you do, realize that you cannot have R# plugins that are compatible between even minor (let alone major) R# versions. In other words, a plug-in for R#5 might not be compatible with R#5.1.
- Your favourite programming language --- all the examples shown in this wiki are for the C# part of ReSharper, and are correspondingly written in C#. There’s nothing preventing you from writing ReSharper plug-ins using VB.NET, F#, Boo or C++/CLI. Please note, however, that SDK templates support only C# and VB, and the SDK samples as well as PowerToys only use C#.
- The ReSharper SDK --- while this part is optional, the ReSharper SDK offers a large set of advantages to plug-in developers, and is highly recommended. Note that, currently, the SDK is the only way to get the test infrastructure to test your assemblies, as they are not packaged inside ordinary ReSharper distributions. In addition, you get PDBs of ReSharper assemblies, as well as a set of project and item templates (so you never have to manually reference ReSharper assemblies again). For more information, see 1.4 SDK Reference.
Note on .Net Framework Version
On a clean Windows machine, Visual Studio comes with .Net Framework 4.0. While you can use .Net 4.0 to develop ReSharper plugins, those plugins would only be usable with Visual Studio 2010 and later. If you intend your plug-ins to be usable with earlier versions of Visual Studio (2005, 2008), you should download and install .Net Framework 3.5 and use it as the target framework for your plug-in projects.
Please note that samples that come with the SDK target .Net 3.5, and in the absence of this framework, VS2010 will offer to retarget your assemblies to .Net 4.0. If you agree, your plug-in will be incompatible with earlier versions of Visual Studio.