1

Example: When i rename the following function public void Foo(){} to public void Bar(){} Then visual studio changes all constant strings, that contain the word "Foo" and replaces "Foo" with "Bar". Same goes for comments.

I NEVER want to replace values in strings with ctrl+r. And i only want to replace the references in the comments, if they are explicitly referenced with cref attribute.

It would be much appreciated if anyone could help me find the related setting in visual studio.

Thanks and kind regards.

I tried: CTRL+R to refactor stuff. ...Comments changed ...Strings changed ...I expect only cref values and C# references to be updated.

I searched for "refactor" in Tools/Options and couldnt find the setting... But i might have overlooked something, because there are tons of options for that term...

I looked for other stackoverflows with that problem. Might have overlooked something there too.

Canabale
  • 157
  • 1
  • 7

1 Answers1

2

There are checkboxes in the rename dialog, accessed by placing the caret on a variable and pressing Ctrl+R, Ctrl+R, that allow you to exclude comments and strings from automatic renaming operations.

enter image description here

madmonk46
  • 421
  • 3
  • 10
  • Thanks. That was exactly what i was searching for... Weird thing I didn't notice that window earlier... Probably because Visual Studio throws around with notifications, like they're dodgeballs... – Canabale Nov 07 '22 at 16:21