Search code examples
teamcityresharpereditorconfig

How do I configure TeamCity to have ReSharper check for properties set in an .editorconfig file?


We have a local instance of TeamCity (2019.1.5) and I would like to take advantage of ReSharper configuration properties set in a solution's .editorconfig file.

Following .editorconfig updates, more build options, better Roslyn support in Rider 2018.3 EAP and Index of EditorConfig properties I have a file that currently consists of the following:

# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
charset = utf-8
insert_final_newline = true

[*.cs]
indent_style = tab
trim_trailing_whitespace = true

# ReSharper custom properties
resharper_unknown_css_class_highlighting = false

However, this by itself wasn't enough to get TeamCity to pick this up, as I'm still seeing "Unknown CSS class" inspections after a build.

Configuring inspection severities with EditorConfig suggests that I may have to enable this in ReSharper if I was using it locally (which I'm not), so I'm wondering if there's a similar setting I have to configure in TeamCity.

How would I go about having TeamCity check an .editorconfig for ReSharper settings?

In response to ReSharper version and shared settings

In response to Dmitry's answer, since it's longer than a comment:

Unfortunately we have JetBrains ReSharper Command Line Tools version 2019.2.1 installed, set as the default, and I've verified that it's being used by the project. (If it matters, 2017.1.20170428.83814 was installed, but was not the default or used; I plan on removing it.)

For your second solution, is the change to the (I assume) .sln.DotSettings documented anywhere, like others? Since we don't have a full version of the ReSharper plugin (yet) we've tried to leverage documentation where we can to make changes to the .sln.DotSettings file manually.

For example, a way to remove this via that file is by this using this .sln.DotSettings file:

<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
    <s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UnknownCssClass/@EntryIndexedValue">DO_NOT_SHOW</s:String>
</wpf:ResourceDictionary>

Solution

  • Easy way: upgrade to ReSharper command line tools 2019.2 or later in your TeamCity installation.

    Hard way: enable "Read severity settings from editorconfig and project settings" and save it to solution shared settings and add them to VCS.

    UPDATE: Tested it myself. Please write none instead of false in .editorconfig:

    resharper_unknown_css_class_highlighting = none
    

    I'm afraid .dotSettings is not properly documented because it isn't meant to be a user-editable file format. Your best bet is to download trial or EAP version of ReSharper or JetBrains Rider and use them to make required modifications if you decide to go that road.