Search code examples
c#resharperjetbrains-iderider

How to import Resharper templates to the Rider


i decided to try Rider instead of Visual Studio(+Resharper) and was faced with the problem of how to easily move my custom templates to Rider. Maybe somebody will point me to the best solution, but now i don't find a way or UI how to import them to Rider. So, i spend some time and find a way how to import them by edit the Rider global settings file.


Solution

  • Precondition: you should export to file your Resharper templates, e.g. "class_template.DotSettings" file.

    open folder '%APPDATA%\JetBrains<version_rider>\resharper-host', e.g. 'C:\Users<user_name>\AppData\Roaming<version_rider>\resharper-host' and open to edit file 'GlobalSettingsStorage.DotSettings'.

    1. Open your Resharper template file and copy all elements inside '<wpf:ResourceDictionary' element.

    2. Then insert it into the 'GlobalSettingsStorage.DotSettings' file and save it (if settings are open, re-open it).

    3. Open Rider and go to the Settings (Ctrl+Alt+S) -> Editor -> File Templates somewhere (under sections) you will see your template.

    4. If it's inserted under an invalid section (Razor instead C#) go to the 'GlobalSettingsStorage.DotSettings' find element and edit or insert element with correct values

      <s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=<template_id_number>/Scope/=<id_number_from_existing_element>/Type/@EntryValue"><section_type_name></s:String>

    where <id_number_from_existing_element> - is the id of the section to which you are planning to insert your template.

    <section_type_name> - is the name of the section to which you are planning to insert your template.

    All these numbers\names you can take from existing templates in 'GlobalSettingsStorage.DotSettings' file.

    This option is helping me to fast insert my templates to the Rider. If somebody knows a better solution, please share it.

    Thanks.