views:

36

answers:

2

Hi

does anyone know of a way to split all classes in one solution into multiple files?

The point here is that I've inherited a project in which a few hundred files contain a thousand or so classes... I'd like to be able to get to a 1 file per class approach..

Using resharper I can easily do this manually, but I'm guessing there must be a better way?

Kind regards

Frederik

+1  A: 

You could try one of the ReSharper 5.0 nightly builds which allow you to do it across your whole solution. You can revert to ReSharper 4.5 (or whatever version you are using) afterwards.

GraemeF
i'll do that, thx!
Frederik
A: 

GraemeF's answer is correct, but when you do that refactoring chances are you'll lose all source-control history for the existing classes. This might not be a problem for you (especially if the system you've inherited wasn't source-controlled!) but I've often found that line-annotated views of a class are very helpful for determining the intent behind a particular line.

ReSharper has the Ctrl-T shortcut to jump to a type name, and holding down Ctrl makes types clickable; that might be another way to solve your problem.

DDaviesBrackett
I find the loss of source control information to be prohibitive, but I'm not sure at what level R# can hook into this stuff. Having said that, Visual Studio + P4 does not even integrate files properly if you drag and drop using the solution explorer! (e.g. drag a folder into a nested subfolder -- some of the files will get integrated, others won't). If the 'normal' tools can't do it properly, I don't hold out much hope for other plugins :(
Mark Simpson