Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Removing part of a namespace across entire project

I know that I can rename a namespace using Visual Studio 2010, but I need to remove part of a namespace.

namespace Xyz.Common.Utils { ... }

Renamed to

namespace Common.Utils { ... }

I need to drop the Xyz part, but don't see a way to use the VS refactoring tool to do this.

like image 775
Reactgular Avatar asked Dec 04 '25 10:12

Reactgular


2 Answers

This is what I did a few times and you don't need any third-party tool:

Refactor the name in to something unique like: fjhfhchdbyegdrkoksodbc (if that's unique enough to you)
Then do a global replace on fjhfhchdbyegdrkoksodbc. (including the dot) with an empty string.

like image 109
Silvermind Avatar answered Dec 06 '25 22:12

Silvermind


This is what I did a few times and you don't need any third-party tool:

Refactor the name in to something unique like: fjhfhchdbyegdrkoksodbc (if that's unique enough to you)
Then do a global replace on fjhfhchdbyegdrkoksodbc. (including the dot) with an empty string.

like image 36
Silvermind Avatar answered Dec 06 '25 23:12

Silvermind



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!