ReSharper plugins via NuGet

by Matt 18. October 2011 10:04

I have this little ReSharper plugin. It is small and rather useful. And one of the most frequent requests I get is for an installer.

I’ve resisted this, mainly because it’s only 4 files. I could see how useful an installer would be, but I wasn’t going to write one just to copy 4 files around. That would be like using a sledgehammer to crack a nut.

Nope. I’m going to use a nuclear bomb to crack a nut.

Instead, I thought it would be more interesting to write an extension manager for ReSharper, based on NuGet. In other words, package ReSharper plugins as NuGet packages, and deliver and manage them in the same way – so you can browse, install, update and uninstall, just like assembly reference NuGet packages.

Something like this:

image

Before we go any further, I need to point out that this is not a finished product – it is very much an experimental ALPHA version. It works, but only just.

It can do the basics just fine – it can browse and install, uninstall and update plugin packages. They’re stored in a nuget repository in your local profile, and get automatically loaded at startup.

The big thing that’s missing is server support. The “Online Gallery” does NOT talk to a server, and is HARDCODED to point at C:\rsrepo.

It’s also missing other useful stuff like error handling, displaying license and progress dialogs and so on.

But it’s functional enough to give a tyre-kicking to, and I’d appreciate the feedback. ReSharper 6.0 only for now.

Here’s what you need to do to get up and running (please read carefully – this is alpha quality!):

  1. Download the zip file from the github downloads page
  2. Extract the contents – you’ll find a .vsix file and 3 .nupkg files
  3. Double click the .vsix file. This will install the plugin (in the future it will be on the Visual Studio Gallery, making this much easier)
  4. Create the C:\rsrepo folder and copy the .nupkg files into it
  5. Fire up Visual Studio
  6. Go to ReSharper –> Extension Manager to bring up the manager UI

If you go to the “Online Gallery” section of the extension manager, you should see the test packages listed. I’ve created a package for the current 6.0 release of xunitcontrib, and two versions of a sample plugin that simply adds a menu item to the ReSharper menu (it just displays a message box with the current version).

Once you’ve installed a package, you need to restart VS before the plugin will get loaded (you’re not yet prompted like NuGet does). Similarly, uninstalling or updating a plugin requires a restart (this is unavoidable – the dlls are loaded into memory and there is no way to unload them. You’ll find the same behaviour in the Visual Studio extension manager).

While you’re in the Online Gallery, you’ll probably notice that it lists all versions of the sample packages, rather than just the latest. Don’t install both versions at the same time – that will confuse things (I told you it was alpha). The two versions are there to test updating – once the oldest version is installed, going to the Updates section will list the newer as ready for updating.

So, what’s next?

Top priority is server support. I need to get a gallery working, and to be able to configure the extension manager with the server feed.

Then, a proper good tidy up – error handling, progress indicators, showing licenses, searching, sorting etc. I’d like to add support for ReSharper 5.1 and the forthcoming 6.1 EAP.

Oh, and more packages would be nice, too.

Creating a package is dead easy – just put your assembly files in an “rs60\plugins” folder. Open one of the sample packages in the NuGet Package Explorer to take a look. Or check out the samples folder in the source on github.

I’d love to hear some feedback. Let me know what you think. Leave a comment here, github or on twitter.

So, that’s how you install 4 files.

Tags:

Comments (5) -

Nordin Rahman
Nordin Rahman
10/18/2011 6:11:38 PM #

This looks interesting. Thanks!

Reply

Mike
Mike
10/18/2011 9:24:54 PM #

Interesting, but something definitely better left for Microsoft or jetbrains to handle. I can't imagine having multiple extension managers for installed add-ons. The VS extension manager It should be made so that any plugin or add in can register in the extension manager to receive extensions specifically for it.

So I hope you can share your work with Microsoft!

Reply

angol
angol
10/19/2011 11:23:08 AM #

wov...R# is cool, NuGet is cool...keep up the good work!

Reply

Mike Murray
Mike Murray
10/20/2011 5:51:11 PM #

I think you should consider Chocolatey as well, as it is better suited to not only bringing down files to the machine but also running initialization and install tasks.

http://chocolatey.org/

Reply

Jake Ginnivan
Jake Ginnivan
10/31/2011 6:43:20 PM #

Awesome work Matt!

Just tried it out, I like it. The thing about ReSharper extensions is you are about the only person actively supporting them. Discoverability is a big thing, and I hope JetBrains helps you out with this if they are not willing to do it themselves. Least they could do is host the Gallery for you Smile

Reply

Pingbacks and trackbacks (1)+

Add comment

biuquote
  • Comment
  • Preview
Loading

Month List

RecentComments

Comment RSS