0

For Resharper 7.1 we had written a Resharper Plugin - which was placed in the C:\Users\<UserName>\AppData\Roaming\JetBrains\ReSharper\vAny\Plugins folder. In VS 2012 the plugin worked without any issue.

The intention of the plugin is to analyze the currently open C# file and check whether our companys file header is written on top of the page. If not it will highlight the entire content.

Now we switched over to Resharper 9.2. I successfully compiled the source code against the Resharper 9.2 SDK downloaded by nuget. But I don't get the Resharper Plugin recognized/working by Resharper.

Did there anything change where the plugin should be placed? I read some suggestions about creating a nuget package - but is this step really neccessary?

I would like to learn how to get the Plugin running.

faronel
  • 333
  • 1
  • 9

2 Answers2

2

Starting with R# 9 simple xcopy-deployment doesn't work anymore and you need to create a NuGet package (also if you don't plan to publish your extension).

See Initial Installation and Local Installation in the R# DevGuide.

ulrichb
  • 19,610
  • 8
  • 73
  • 87
2

Bad mood to not read the documentation before asking a question. The R# documentation is quiet helpful.

How I solved the problem:

I renamed the project such that a '.' is in the project and assembly name, lets say Company.MyPlugin. I'm completly new in nuget, but I figured out that I need to run >nuget.exe spec in the directory where the Company.MyPlugin.csproj is located. Nuget will create a Company.MyPlugin.nuspec file which I had to edit. I removed some parts since I do not want to deploy the plugin online.

<?xml version="1.0"?>
<package >
  <metadata>
    <id>Company.MyPlugin</id>
    <version>1.0.0.0</version>
    <title>My Plugin Title</title>
    <authors>Myself</authors>
    <owners>Company</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>Some description.</description>
    <copyright>Copyright 2015</copyright>
    <dependencies>
      <dependency id="Wave" version="[3.0]" />
    </dependencies>
  </metadata>
  <files>
    <file src="bin\Release\Company.MyPlugin.dll" target="DotFiles" />
  </files>
</package>

Note that I want to make the package available for R# 9.2, so I need a dependency to Wave 3.0. Somewhere I read that there should also be a dependency to Resharper 9.2 and somewhere it was stated out that this is no more neccessary. It worked for me without the Resharper 9.2 dependency.

Create the nuget package with >nuget.exe pack Company.MyPlugin.nuspec. Some warnings will appear concerning that the assemblies are not in the lib folder. Ignore these warnings.

It was not yet done. Since JetBrains moved from the product R# to the Resharper Platform I had to create a so called ZoneMarker. These days JetBrains says that there is not yet appropriate tooling to figure out what the proper ZoneMarker is (see JetBrains Devguide HowTo ZoneMarker). As a temporary solution you can define an empty ZoneMarker.

using JetBrains.Application.BuildScript.Application.Zones;

namespace Company.MyPlugin
{
  [ZoneMarker]
  public class ZoneMarker
  {
  }
}

Having the ZoneMarker added I was able to compile the assembly, run nuget to create a packe. Adding the proper directory to the Package Sources in R# options menu let MyPlugin successfully appear in the Extensions Manager and - that's pretty cool - it was working. :)

I strongly recommend to read the devguide. Have a look at the JetBrains Devguide Extensions Troubleshooting also.

faronel
  • 333
  • 1
  • 9