ReSharper SDK Now Available on NuGet

With the recent announcement of the ReSharper 8.1 EAP, we’ve made steps to address one of the common requests of plugin authors – to ship the ReSharper SDK as a NuGet package. Previously, we’ve shipped the SDK as an MSI installer that would install Visual Studio templates, MSBuild targets, tools and reference assemblies, or as a standalone zip file, containing the same files.

While this works just fine for developing on your own machine, it doesn’t play nicely when building on a Continuous Integration server such as TeamCity. You have to manually install the SDK on each build agent, or check the assemblies into your source control, which is undesirable, due to the size of the SDK and because source control is optimised to text files, not binaries.

So, what’s changed?

Firstly, the MSI install still exists, but it no longer installs the tools, targets or reference assemblies. Instead, it only contains the Visual Studio project and item templates and the samples. The project templates will create plugin and plugin test projects, with the NuGet packages already referenced. To prevent having to download the NuGet packages every time you create a new project, the project templates contain a snapshot copy of the packages, which are installed to the Visual Studio install folder, under the Common7IDEExtensionsJetBrainsReSharper SDKv8.1Packages folder.

Visual Studio project templates

The JetBrains.ReSharper.SDK package is the core NuGet package to reference in your plugin project. It includes the reference assemblies, xml documentation files, target files and tools required to build a plugin. Adding a reference to this package from a blank class library project is all you need to do to create a new plugin. However, you might want to still use the Visual Studio project template to create a project. The template will automatically add the NuGet reference, and it will also setup the debug command line , as well as add plugin metadata attributes and provide example action handlers to get you going.

PM> Install-Package JetBrains.ReSharper.SDK -Version 8.0.1243

Currently, the stable package on nuget.org is the 8.0 SDK. The 8.1 EAP SDK package is a pre-release package that we’re shipping as part of the on-going EAP process, which means you’ll need to select the “Include pre-release” option in the NuGet dialog, or use the “-pre” option for the Install-Package command. We’re also shipping the JetBrains.ReSharper.SDK.Tests package to add to your test project to enable writing tests for your plugin.

PM> Install-Package JetBrains.ReSharper.SDK -Pre

We’ve put together the following guidelines for using the NuGet packages:

  • Don’t commit the NuGet packages folder to your source control repository. You should use NuGet’s package restore feature to automatically download and add back the package. This happens automatically in Visual Studio, you can use the nuget restore from the command line, or as part of your CI build process. TeamCity provides a NuGet installer build step to make this easy.
  • You can use a custom, local package source to prevent multiple downloads, or if your CI server doesn’t have Internet access.
  • Remember that you can pin a package reference to a particular version. For example, you could edit your packages.config file to pin your project to the current 8.0 SDK by setting the version to: version="[8.0.1243]". This will always use the 8.0 version of the SDK, even with package restore, while also allowing another project to use the latest version for the 8.1 EAP. And since the packages folder uses version numbers in the folder name, you can include multiple different versions of the SDK in your solution, to support e.g. 8.0 and 8.1 EAP.
  • You can update your existing 8.0 projects to use the NuGet package by removing the import of Plugin.Targets and the ReSharperSdkTargets property from the bottom of the file. Then simply add a reference to the JetBrains.ReSharper.SDK package.
  • The packages require NuGet 2.7, due to the improvements in handling package restore and importing target files.

Please let us know how you get on with the NuGet package – you can report issues on our YouTrack instance, and next time, we’ll take a look at adding 8.1 EAP support to your ReSharper extension.

This entry was posted in ReSharper Tips&Tricks and tagged , , , , , , , . Bookmark the permalink.

5 Responses to ReSharper SDK Now Available on NuGet

  1. Hazzik says:

    Please release previous versions of SDK

  2. Bill Sorensen says:

    Any chance of adding prebuilt versions of some of the samples to NuGet? In particular, we have to rebuild SamplesCyclomaticComplexity with every major version of ReSharper.

  3. Matt Ellis says:

    Yep. Some of the more useful samples are already on the gallery – e.g. the cyclomatic complexity extension is here: https://resharper-plugins.jetbrains.com/packages/PowerToys.CyclomaticComplexity/

    They’re currently available for 8.0, I’ll be updating them for 8.1 this week.

  4. Matt Ellis says:

    @Hazzik – we’ve currently got 8.0 and the 8.1 EAP SDKs released, and we’re looking into releasing the 7.1 SDK too.

  5. Daniel Marbach says:

    The 8.0 SDK seems to require target framework 4.0. Is that right? This is a breaking change. The previous versions allowed to have target version 3.5

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>