Help need migrating plugin from R#8 to R#9

I have my plugin compiling with R#9 SDK and I believe it installed ok using extensions manager pointing to a local nuget package. isn't loading within VS. I am running VS with /Resharper.Internal and I don't see any exceptions thrown. I also tried turning on debug verbose logging via the 'internals' menu but the log files created are zero bytes.

I see the nuget package layout changed...where do I look to get an insight into why it is failing to load? I have my DLL within dotFiles nuget folder...and can see copied into AppData\Local\JetBrains\Installations\ReSharperPlatformVs11

Secondly, I have a couple of references within my unit tests that I need help resolving:

  • ReSharperTestEnvironmentAssembly
  • DataContextOfTestTextControl.Create - I used this class to get the datacontext needed by a call to IExecutableAction.Execute  Many thanks for any help in advance

Apologies for all the queries !


Hi. There are a couple of gotchas for installing to R# 9, unfortunately. Firstly, make sure your package has a "." in the name - it will not be properly installed if it doesn't. E.g. it should be "Foo.Bar" and not just "Bar". Secondly, there must be a zone marker in the lowest common namespace in your plugin - if you have namespaces "Foo.Analaysis" and "Foo.QuickFix", you need a zone marker in the "Foo" namespace. I've got reports that this is required to install, but I need to confirm this. These issues should be visible in the installer log, which is in %LOCALAPPDATA%\JetBrains\Shared\v01.

As for logging, you can enable it via the Logging page when /ReSharper.Internal is enabled. By default, it will output all VERBOSE and lower (i.e. basically everything except TRACE) to OutputDebugString, meaning you'll need a debugger attached to see the messages. To get it to output to file, uncomment the "file" appender close to the top of the file, and then add it to the <root> element lower down - uncomment the <appender-ref>file</appender-ref> line. I'm not sure if you need to restart for this to be picked up, but it should start logging to c:\logs. The best thing to do is open the log file and search for your assembly name, and also any namespaces.

There are changes to testing that mean anything using ReSharperTestEnvironmentAssembly needs updating. I'll have the docs updated over the next couple of days. DataContextOfTestTextControl.Create is still there, but moved to a different namespace - use ReSharper's import completion to bring it in.


Hello Matt, thanks for helping...  Tried a couple of things but still nothing is firing up. Logs say the package was installed ok but none of my plugin features are coming to life. As suggested I've added a 'zonemarker' at the root namespace (just like My root namespace is TestCop.Plugin so the zone marker class is TestCop.Plugin.ZoneMarker  The assembly name is currently called Resharper.TestCop.dll (so it has the dot). The log files have content..but don't offer any clues

|V| NugetBuildHelpers             | Package NVelocity.1.0.3: files (2pcs)[“NVelocity.dll (232 KB)”, “NVelocity.xml (343 KB)”].  
|V| SimpleFileItem                | SimpleFileItem,Created,Size,151040,Stream,Zakym,Path,Resharper.Testcop.dll,  
|V| SimpleFileItem                | SimpleFileItem,Created,Size,271872,Stream,Febeg,Path,Resharper.Testcop.pdb,  
|V| NugetBuildHelpers             | Generating fake JetMetadata for package Resharper.TestCop.  
|V| NugetBuildHelpers             | Fake JetMetadata for nupackage Resharper.TestCop. yields application package sp TestCop by Resharper with files (2pcs)[Resharper.Testcop.dll, Resharper.Testcop.pdb].  
|V| SimpleFileItem                | SimpleFileItem,Created,Size,1587,Stream,Ryleq,Path,Resharper.TestCop.JetMetadata.sstg,  
|V| NugetBuildHelpers             | Package Resharper.TestCop. files (3pcs)[“Resharper.Testcop.dll (147 KB)”, “Resharper.TestCop.JetMetadata.sstg (1.54 KB)”, “Resharper.Testcop.pdb (265 KB)”].     

PS: Can't find DataContextOfTestTextControl even using DotPeek ?


Is that the installer log? What about the main product log? Is there anything there for Resharper.TestCop?

Is your zone marker the same as the example one? For now, it should have no other interfaces, just an empty class:

public class ZoneMarker

Ideally, it should be better specified, but doing that by hand is error prone, and could really do with diagnostics that aren't ready yet. Setting it to an empty class with no inheritance means it will be enabled correctly.

DataContextForTestTextControl is now part of an internal "test cases" package, rather than the public "test framework" package - i.e., it's an implementation detail for value tracking tests. The class itself is pretty straightforward:

public static class DataContextOfTestTextControl
  public static IDataContext Create(Lifetime lifetime, ITextControl textControl, ISolution solution)
    var provider = new List<IDataRule>();
    provider.AddRule("Test", DataConstants.DECLARED_ELEMENTS, ctx=>TextControlToPsi.GetDeclaredElements(solution, textControl).ToDeclaredElementsDataConstant());
    provider.AddRule("Test", TextControl.DataContext.DataConstants.TEXT_CONTROL, textControl);
    provider.AddRule("Test", ProjectModel.DataContext.DataConstants.SOLUTION, solution);
    provider.AddRule("Test", DataConstants.REFERENCE, ctx => TextControlToPsi.GetReferencesAtCaret(solution, textControl).FirstOrDefault());
    provider.AddRule("Test", DataConstants.SELECTED_EXPRESSION, ctx => ExpressionSelectionUtil.GetSelectedExpression<ITreeNode>(solution, textControl, false));
    return Shell.Instance.Components.ActionManager().DataContexts.CreateWithDataRules(lifetime, provider);


Yes - my zone marker looks like that. Strangely the extension installer doesn't always ask me to restart VS...

These are the type of entries I see within the install log (AppData\Local\JetBrains\Shared\v01)

|V| NugetBuildHelpers             | Fake JetMetadata for nupackage Resharper.TestCop. yields application package sp TestCop by Resharper with files (2pcs)[Resharper.Testcop.dll, Resharper.Testcop.pdb].

|V| NugetBuildHelpers             | The Nuget package Resharper.TestCop. does not have the embedded JetManifest.


|V| BuildBinaryFileItems          | Expanding Nuget package “Resharper.TestCop”.

|V| SimpleFileItem                | SimpleFileItem,Created,Size,150528,Stream,Qovud,Path,Resharper.Testcop.dll,

|V| SimpleFileItem                | SimpleFileItem,Created,Size,271872,Stream,Gitet,Path,Resharper.Testcop.pdb,

|V| BuildBinaryFileItems          | All expanded files: (2pcs)[“Resharper.Testcop.dll (147 KB)”, “Resharper.Testcop.pdb (265 KB)”].

Do you have any logs from running the product?


I moved forward when I downloaded the latest Resharper and this time my plugin appears within the menu (after a restart)...and I can see a couple of exceptions within the login file for me to investigate ...


Can you give me an example on how to set up keyboard shortcuts for an IExecutableAction? Is now the action.xml ?


I've found an example

[Action("&Go to Line...", Id = 3246, IdeaShortcuts = new string[] {"Control+G"}, VsShortcuts = new string[] {"Control+G"})]

  public class GotoLineActionHandler : IExecutableAction, IAction

However, the keyboard shortcut isn't applied for my plugin unless I go into Resharper and reapply the keyboard can I get this to happen on plugin install ??


Did you find a way to apply shortcuts at plugin installation?

Should I continue to use my DTE.Commands.Item hack?



Nope, you just need to specify the shortcuts on the Action attribute. These are used to statically register the actions as VS commands during installation. Because the VS commands are statically registered, the shortcuts are persistent, and can be modified, and the modification is also persistent (hooray!)


Just noticed the first part of the question - not sure why your action shortcuts weren't being applied appropriately. However, if you were simply copying the dll into the installations folder (i.e. build + copy, build + copy) then it wouldn't work. When you change the registration details of an Action, you need to re-install that extension so it can be statically registered with VS.



Here is example of my action:

[Action("Copy Current Word", Id = 11122234, IdeaShortcuts = new[] { "Control+Shift+W" }, VsShortcuts = new[] { "Control+Shift+W" })]
public class CopyCurrentWord : IExecutableAction

Options -> Enviroment -> Keyboard & Menus have Resharper 2.x or InteliJ IDEA selected

The binding above doesn't apply after plugin installation using Resharper Extension Manager.

The keyboard binding does apply when I click "Apply Scheme" in options.

After Resharper installation I customized some shortcuts, maybe this is why it doesn't work after plugin installation.



Hello Viktar,  I too could only get the shortcut to take effect if I asked it to 'reapply shortcuts'. In the end I decided to just stick with the workaround I put in place for R#8 and map the shortcut in the code for R#9 too. Note that your shortcut macro name will be different in R#9



Please sign in to leave a comment.