How to remove redundant type qualifier solution wide?

1.6k views Asked by At

Throughout our solution we have redundant type qualifiers like the following:

using Project.Folder;
...
Project.Folder.Enum enum = Project.Folder.Enum.Option;

I am looking for a way to find and remove all the Project.Folder.'s that are redundant (some won't be). Is there any tool other than Resharper that is capable of this mass refactoring?

3

There are 3 answers

0
Warwick Allison On BEST ANSWER

For future questioners, note that in Visual Studio 2019, you can do this similar to Resharper. Right click on a refactoring suggestion and there should be a "fix in entire Solution" option.

VS 2019 solution-wide refactor

0
MaxRev17 On

Without being able to use resharper I would just ctrl + shift + h and replace with nothing and then try to build - the list of errors will let you double click through to each one and you know exactly how to fix it. Time consuming but probably the only easy way forward.

0
meleAstur On

I suffer the same with R file and resources for redundant qualifier names and I do this:

CntrlShift+R

Fill "search box" with your package.R

com.yourpackage.R 

Fill "replace box" with

R

Them see results and click replace with the references you want

For me is the fasted workaround for now, hope someday the option cleanup code do it for itself