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.

2
  • can you add a sample code to make the question clear? Commented Nov 7, 2022 at 13:07
  • Ctrl+R, Ctrl+R command not working you can try this as well. Commented Nov 7, 2022 at 13:13

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

1 Comment

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...

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.