13

Is there a way to exclude certain files from Resharper's Code Cleanup? I have a range of generated files I'd like to leave untouched.

I found the below question, however the answer's there are workaround's for the specific issue, and don't answer how to actually exclude files. (If it's possible)

Is there a resharper comment directive to disable code cleanup for a class?

Community
  • 1
  • 1
Chris
  • 5,882
  • 2
  • 32
  • 57

1 Answers1

23

If you go to ReSharper Options > Generated Code and add your file to the list of Generated Code or Generated File masks then it will be skipped by the Code Cleanup process.

Picture of the relevant pane of the ReSharper options

meh-uk
  • 2,031
  • 1
  • 23
  • 36
  • Does that work for code-clean-up too? I didn't realise! Thank you, I'll check it out later and see if it's successful. – Chris Aug 13 '15 at 15:46
  • It did when I just tried it ;). I'm using ReSharper 9.2 RC at the moment. – meh-uk Aug 13 '15 at 15:47
  • In newer versions of R# there is also the *Code Editing | Third-Party Code* section that can be useful for excluding things that are not generated. – vossad01 Oct 18 '17 at 17:46
  • This does not appear to affect code cleanup, at least not on Rider 2023.1.3. – awshelleyBeckman Aug 01 '23 at 18:14