views:

33

answers:

1

I have a bunch of c# code I inherited that has "using" statement declarations like this

using Foo;
using NS1=Bar.x.y.z;

and I've been asked to make our codebase consistent with regard to namespacing - the policy is simply that

  • 1 some namespaces should always be fully qualified (no aliases) - for example things inside "Foo" above should always be fully qualitied.

  • 2 some namesapces like Bar.x.y.a should always be accessed through a specific using alias ("NS1" in the above example)

To illustrate what is desired,

if this is the BEFORE code

using FOO;
int x = SomeClass1.SomeStaticMethodMethod(1); // where SomeClass1 is in "FOO"
var y = new Bar.x.y.z.SomeClass2()

this is what is desired AFTER

using NS1 = Bar.x.y.z;
int x = Foo.SomeClass1.SomeStaticMethodMethod(1); // where SomeClass1 is in "FOO"
var y = new NS1.SomeClass2()

Of course I can do all this manually. But I have a lot of files to Fix. I'm looking for a tool that can do this over many files (100s of .CS files). I even have the latest version of Resharper (5.1) which doesn't seem to let me do this. (Actually resharper is in fact causing more problems because it loves adding using statements I don't want)

Are there tools or techinques I can use to simplify my task? I am allowed to purchase more dev tools so commercial tools are an option for me.

A: 

I know it probably is not ideal buy you could use DxCore from DevExpress to write a plugin similarly to those http://code.google.com/p/dxcorecommunityplugins/

mfloryan