We use ReSharper/Rider on our .NET 4.7 project, and we have it configured to auto-format the files we edit whenever we save. This behavior applies to *.cs files, as expected, but it unfortunately also applies to some files that the IDE generates(for example: those huge App.Config files with all of those binding redirects). This is a problem because ReSharper/Rider's formatting rules do not match the format the IDE uses when generating(or automatically modifying) them. If we ever need to make a manual change to such a file(IE: to solve a merge conflict), then ReSharper/Rider will automatically re-indent everything upon saving, using its own rules. Then the next time that file gets modified by the IDE(IE: to add a new binding redirect for a newly-installed package), it will be re-indented using the IDE's formatting rules(which are different from ReSharper's).
To avoid this problem, we would like to exclude certain file types from being auto-formatted by ReSharper/Rider. And we'd like this setting to be automatically shared amongst all of our developers, similar to how ReSharper/Rider's other settings are(IE: in an editorconfig or a dotsettings file).
I have tried using the setting File | Settings | Editor | Code Style | Do not format:
, but that setting does not get shared with my team. It appears to not be saved in the DotSettings file.
I tried changing the setting specified in this other StackOverflow question, but that didn't work; it did get shared with my coworkers, but it didn't have any effect on which files get auto-formatted. I'm assuming that answer is out-of-date, given that it is from 2015.
I also tried changing File | Settings | Editor | Inspection Settings | File masks
, but still no luck. This setting does get shared with the rest of the team, but it doesn't prevent any files from being auto-formatted.
I do not believe this question is a duplicate. To prove that I've done my due diligence, here are the closest questions I've found, and why I don't believe it's a duplicate.
- How to disable Resharper auto format on save in VS2015
- This question asks about disabling all auto-formatting, which I do not want.
- Exclude files from solution-wide Code Cleanup in Resharper
- This question is close to what I want, but its answer is either out-of-date or just plain incorrect.
- Prevent ReSharper from formatting specific code block
- I do not want to disable formatting for specific blocks, I want to disable it for all files with a given extension
- ReSharper JSON disable Auto-format
- The title makes it sound like it's asking for exactly what I want, but the content of the post is actually asking to disable auto-format while typing, not auto-format on save.