Plugin Deployment

Skip to end of metadata
Go to start of metadata

Of all the possible plugin loading scenarios (loaded by ReSharper versus loaded by VS and then connected to ReSharper, see [Plugin Integration] for details) this page considers the case when you'd like ReSharper to load your code automatically, modifying the Visual Studio menus on your behalf.

Copying Files

ReSharper looks for plugins at a few special locations. Choose your installation destination folder from this list.

You should create a folder under one of these locations and place your plugin DLL files into that folder.

  • Per-Machine Plugins.
    Visible to all of the users on this computer. Requires elevation at install time.
    Folder: JetBrains.UI.Application.PluginSupport.PluginManager::PluginsDirectoryMachine.
    Example path: "C:\Program Files (x86)\JetBrains\ReSharper\v5.0\Bin\Plugins\" + "MyPluginName\MyPlugin.dll".
    Loads into ReSharpers with the same two-digit version from that install location.
    Applies to all Visual Studio versions supported by the ReSharper whose installdir you're using. Note that it is possible to install a different R# version into each of Visual Studio versions, even for ReSharpers within the same two-digit version. In this case the plugin will only load into one of such ReSharpers, and only into those Visual Studios that ReSharper is installed for.
  • Per-User, Non-Roaming Plugins.
    Visible to the current user only. Does not require elevation.
    Folder: JetBrains.UI.Application.PluginSupport.PluginManager::PluginsDirectoryUserLocal.
    Example Path: "C:\Users\MyUserName\AppData\Local\JetBrains\ReSharper\v5.0\vs9.0\Plugins\" + "MyPluginName\MyPlugin.dll".
    Loads into ReSharpers with the same two-digit version (all of them, if multiple installations).
    Loads into the only Visual Studio version listed in the path (vs9.0 in the above example).
  • Per-User, Roaming Plugins.
    Visible to the current user only. Does not require elevation.
    Folder: JetBrains.UI.Application.PluginSupport.PluginManager::PluginsDirectoryUserRoaming.
    Example Path: "C:\Users\MyUserName\AppData\Roaming\JetBrains\ReSharper\v5.0\vs9.0\Plugins\" + "MyPluginName\MyPlugin.dll".
    Loads into ReSharpers with the same two-digit version (all of them, if multiple installations).
    Loads into the only Visual Studio hive listed in the path (vs9.0 in the above example).
    Stored on the server in a domain network, roams to any computer the user logs on. You should avoid placing sizable files in this location.

Note that ReSharper will also try loading plugin files right from the Plugins folder, without any subfolder, but this is highly not recommended for any needs other than testing.

Second-level subfolders of the Plugins folder are not inspected for plugins. Any plugin DLLs in those folders will be ignored.

Visual Studio hive in per-user folder paths is not just a Visual Studio version, but the full hive string, which includes the Visual Studio RootSuffix: "vs"<VsVersion2><VsRootSuffix>, for example, for an experimental suffix named "Exp" of Visual Studio 2008 the folder name will be "vs9.0Exp".

Plugin and Non-Plugin Files

Plugin DLL

To be loaded by ReSharper, your plugin must have at least one Plugin DLL file. From this file, the components (JetBrains.ComponentModel.IComponent) are instantiated, actions and UI controls are populated, option pages are registered, and so on.

Currently there're no limitations on the DLL file name. All of the DLL files in the plugin folder are considered to be plugin DLLs and are loaded by ReSharper. Of these DLLs, one is nominated as the Main Assembly of the Plugin (see PluginTitleAttribute below). This difference is not very important, this assembly is mainly used as the plugin identity for internal needs.

Attributes

There're a few custom attributes for describing the plugin. They are:

  • JetBrains.UI.Application.PluginSupport.PluginTitleAttribute
    Denotes the Main Assembly of the Plugin. In case of an ambiguity the behavior is undefined.
    Provides additional information about the plugin to the user, as displayed in the Plugin Manager.
  • JetBrains.UI.Application.PluginSupport.PluginDescriptionAttribute
    Provides additional information about the plugin to the user, as displayed in the Plugin Manager.
  • JetBrains.UI.Application.PluginSupport.PluginVendorAttribute
    Provides additional information about the plugin to the user, as displayed in the Plugin Manager.

Non-Plugin Files

Any files other than DLLs are ignored by ReSharper and could be deployed for use by your plugin. Any files in second-level subfolders (and deeper) are also ignored, so they could be used a place for any DLLs that should not be loaded by ReSharper along with the plugin.

It is not currently possible to hide a DLL file in the plugin folder from being loaded as a plugin.

Command Line

For testing purposes, it is possible to load an arbitrary DLL as a ReSharper plugin. This requires passing a key and value to the devenv process command line.

The short name of the command line key is available at JetBrains.UI.Application.PluginSupport.PluginManager::PluginCommandLineSwitch. Currently it is "Plugin". To get the full name of the command line key, add the product name and Visual Studio root suffix name, <ProductName>.<KeyShortName>[.<RootSuffixName>]. Example: ReSharper.Plugin in the default rootsuffix, ReSharper.Plugin.Exp in an experimental rootsuffix named Exp.

The command line value is the full path to the plugin DLL file.

Example of the full command line:
devenv.exe /ReSharper.Plugin t:\MyPlugin\PluginFile.dll

Adding User Interface

Optionally, your plugin might use ReSharper functionality to add user interface commands, menus, toolbars, and keyboard shortcuts to Visual Studio in a declarative manner.

For this, you should provide an Actions.Xml file in the resources of your product DLL, a JetBrains.ActionManagement.ActionsXmlAttribute to expose that file, and action handler classes for all of your actions. This topic is explained in details elsewhere.

For ReSharper to apply all of these to Visual Studio, you must trigger the One-Time Initialization mechanism at install time. More importantly, this also must be done on uninstall for ReSharper to cleanup after your plugin. This requires editing Registry, either HKEY_LOCAL_MACHINE hive if you're installing per-machine (see Copying Files above concerning per-machine and per-user plugin locations), or HKEY_CURRENT_USER hive if you're installing per-user. Note that this does not require any more elevation than installing the plugin files themselves.

See One Time Initialization for details on writing the Registry for the purposes of triggering the UI update.

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.