Rider Code Cleanup vs. JetBrains.ReSharper.CommandLineTools CleanupCode (CI Piplines)


i am working on our CI Piplines for a new project and wanted to do some things right. Currently I am struggeling with a step in the pipeline which validates that all files are correctly according to our code cleanup rules. I am using the 'dotnet tool run jb -- cleanupcode' command for this in the pipeline and what I am seeing is that it produces different results compared to executing the full code cleanup in Rider. This happens even if i export our rules as DotSettings and after a reset of all layers. What i am trying to achieve is that the pipeline fails if 'dotnet tool run jb -- cleanupcode' changes files. Then i expect the developer who made the commit to do the code cleanup locally with Rider. But as the two ways produce differnt results the pipeline always fails as the code cleanup in Rider does not do the changes the 'dotnet tool run jb -- cleanupcode' will do. 

What am I doing wrong here? 


Hi M Mattes

Thank you for contacting us! Please make sure to I make all configurations locally with Rider, save the settings to the Solution Team-Shared layer, and then commit the resulting YourSolution.sln.DotSettings file in the solution alongside the .sln file. Command-line tool on the server will find and apply these settings.


Hi Andrey Simukov

thank you for your reply but i am afraid this does not work. What i have done now.... 

1. I went to the Code Cleanup Settings > Manage Layers

2. I did reset all layers as i want to start with the default settings 

3. I exported the Solution team-shared Layer to a MySolution.sln.DotSettings 


Now when i run the Built-in: Full Cleanup in Rider i do get three files changed one is a .cs, the other two are .proto files. 

If i do the same with 'dotnet tool run jb -- cleanupcode' then i do get five files changed. One is the same .cs file the other four are .json files 

I assume that the .proto files are reformated due to a plugin in rider which does not exist in the dotnet tool? So i could exclude the .proto files. But i dont get why the dotnet tools change json files and rider not. And actually my preferred solution would have been to have the exact same result on both rider and the dotnet tool which i am not getting right now. 


M Mattes Please make sure you have chosen the Scheme: "Project" (not the "Default") in Rider at File | Settings | Editor | Code Style | JSON

Does it make any difference?


Andrey Simukov Unfortunately this does not help. It seems that 'dotnet tool run jb -- cleanupcode' is using Tab size, which is set to 4, rather then Indent which i set to 2. See screenshot below which shows the change applied by 'dotnet tool run jb -- cleanupcode' and the Project settings. 


M Mattes,

Unfortunately the JSON settings from Rider can't be saved into the .DotSettings file. We recommend using .editorconfig to store JSON formatting settings.


Andrey Simukov

This confuses me now, isnt .DotSettings similar to .editorconfig? May i am on the wrong track but i simply want to make sure that our developers see the exact same output in regards to code style and codeinspection in Rider as what the pipeline, i am building, will report running dotnet  tool run jb -- cleanupcode and inspectcode and i dont know whats the best way to achieve this. 

Is this even the best approach or is there a better way ? 


M Mattes 

I'm sorry for the inconvenience, JSON implementation in Rider doesn't support .DotSettings. You can use .DotSettings for the other features and .editorconfig for JSON only. They wouldn't clash each other.

Another option is using .DotSettings for all settings except formatting. Please refer to the webpage for more details: https://www.jetbrains.com/help/rider/Using_EditorConfig.html


Andrey Simukov

thank you, not what i have had hoped for but then i will sort it out somehow 


Please sign in to leave a comment.