Reputation: 3049
I replaced the usage of an extension method with Find-Replace, because Resharper unfortunately could't replace it properly. Now, I have 4000 errors in the solution, and all of them are because the namespace for the new method is missing, so I'm in a desperate need of a "fix/import all missing namespaces in the solution" functionality.
Does Resharper or some other tool have such a thing or I'm going to spend the next hours going through the files, pressing ALT+ENTER?
Upvotes: 7
Views: 5579
Reputation: 1875
To build on trailmax answer:
Add line of text to beginning of multiple files and cleanup namespaces
(.*) find everything (if the dot matches newline has been ticked)
\r\n is the normal eol for windows
\1 represents what has been matched by (.*)
Upvotes: 0
Reputation: 35106
Been there, done that.
This might be not the most elegant way, but it worked for me and took like 10 minutes on a massive project. I've used global replace tool and added using MyApp.Domain.Required.Namespace
to the top of all files. Then used R# on all the files to cleanup namespaces: select project in Solution Explorer, hit Ctrl+Shift+R and select "Adjust namespaces".
But do a checkin/shelf/stash whatever with your version control so you can roll back. It took me a few attempts before I got R# to cleanup namespaces correctly.
Upvotes: 10