Home > Software engineering >  Visual Studio Refactoring changes to many things
Visual Studio Refactoring changes to many things

Time:11-08

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.

CodePudding user response:

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

  • Related