ReSharper Integration

Introduction

ReSharper is a productivity tool by JetBrains for Microsoft Visual Studio C# projects. The TIOBE StyleCop plugin integrates TICS with ReSharper and Visual Studio so that your TIOBE C# coding rules are checked while you type. The plugin uses your company-wide TICS coding standards configuration, respects your local TICS client configuration, and understands TICS violation suppressions.

Requirements and Installation

TICS uses a custom version of the StyleCop plugin for this functionality. As such, the following versions of ReSharper are currently supported:

Note that support for 8.0 is dropped. Please upgrade to 8.2. Make sure you have installed one of the supported ReSharper versions.

The TIOBE StyleCop plugin works with TICS 7.3 and higher. There are two scenarios:

TICS is already installed

If you already have a TICS installation on your machine, the preferred way to install the ReSharper plugin is to download the TIOBE StyleCop installer. To verify that TICS is correctly configured on your machine, you should be able to execute the command "TICS.exe" on the command-line (cmd.exe). After running the TIOBE StyleCop installer, click next on the first two screens, you should see the following screen:

If the option "R# integration" is not available, you do not have ReSharper installed or you are running an unsupported major/minor version. When clicking next, you might get a screen warning about an unsupported ReSharper build. This is usually not a problem. Just check the box and continue.

TICS is not yet installed

If you perform a clean TICS installation, the ReSharper integration is automatically performed by the TICS installer. The TICS installer detects whether (a supported version of) ReSharper is installed and will silently download and execute the TIOBE StyleCop installer.

After Installation

After installation you can verify that TIOBE StyleCop was successfully installed as follows:

Usage

The TIOBE C# coding rule violations are shown automatically while you type in the same way as the built-in ReSharper violations: as blue squiggly lines. Hovering the line gives a description of the problem. TIOBE violations have their rule id between square brackets.

Note that it might take some time for ReSharper to start checking your file. If you expect to see a violation but do not see one, try adding a space somewhere in the file to activate ReSharper.

Manually invoking checker

You can also manually invoke the checker, by clicking "Run TIOBE StyleCop" in the context menu of a file or project in Visual Studio's Solution Explorer. Violations show up as warnings in the Error List panel. Invoking the check in this way does not require ReSharper. If you installed the TIOBE StyleCop plugin without having ReSharper installed, this is the only way to invoke the checker.

Disabling rules

If you only want to see violations for TIOBE rules, you can hide all ReSharper C# rules as follows:

Note that only ReSharper's C# rules are hidden. You can re-enable individual rules by going to the "Inspection Severity" settings panel. You can re-enable all rules by clicking "Reset to Defaults".

Troubleshooting

Could not find TICS.exe on your path

This happens when TICS is not installed on your machine, or TICS.exe cannot be found on your PATH environment variable.

An error occurred while copying TiobeRules.dll

When starting Visual Studio, the plugin tries to make a local copy from the directory %TICS%\..\chk\StyleCop\TiobeRules.dll to %LOCALAPPDATA%\TIOBE\StyleCopSDK\ShadowCopy. Verify that the source directory is accessible and contains the DLL. Verify that any mapped network drives are connected. If the source directory does not contain the DLL, contact your TICS representative. Verify that you have write permissions in the target directory.

An error occurred while loading one of the StyleCop add-ins

When starting Visual Studio, you get an System.IO.FileLoadException: Operation is not supported. This can happen when one of the DLLs in %TICS%\..\chk\StyleCop\ is blocked. This is a security measure of Windows for files coming from "untrusted" sources. Right-click the offending files in Windows Explorer and choose "Unblock". Although the TICS installer should take care of unblocking these files, it might in some rare cases be necessary to do this manually.

All TIOBE violations are missing

Make sure that you are running a supported version of ReSharper and that the TIOBE StyleCop plugin is installed:

Some TIOBE violations are missing

There can be several reasons why you see some TIOBE violations, but violations for some rules appear to be missing:

Upgrading

The TIOBE rule checker (TiobeRules.dll) is automatically copied from %TICS%\..\chk\StyleCop when Visual Studio starts, so that you do not have to run the TIOBE StyleCop installer each time a new rule is added. However, sometimes it is needed to upgrade the TIOBE StyleCop plugin, for example when you upgrade your ReSharper version. To upgrade, your first have to manually remove TIOBE StyleCop. Please refer to the uninstall section.

Uninstalling

Go to "Add or remove programs" in the Windows Control Panel and uninstall the "TIOBE StyleCop 4.7" entry.