I'm using the Resharper trial and VS2008. Is it possible to extract all classes from one file into a separate file? I'm able to do this using Resharper but it only seems to work for individual classes. This is to be used on a file that was auto-generated that is 65,000 lines long.
3 Answers
If you're using ReSharper 5, on the solution explorer, press Ctrl+Shift+R to invoke the Refactor menu (or alternatively right-click and locate it) and select "Move Types into Matching Files"

- 4,656
- 2
- 24
- 13
-
2Ah, I see what I did wrong. I was trying to get the refactor menu to show me that option while I was in the file. – Mike Jul 30 '10 at 00:18
For those that are running a newer version of Visual Studio, there is yet another solution (I realize the question mentions VS 2008). Visual Studio 2017 offers functionality similar to what Eduardo Molteni described for CodeRush. You simply click on a class name, click on the light bulb icon to the left, and select "Move type to xxxx.cs".

- 1,223
- 2
- 16
- 35
-
1
-
This is great for 1 file. I can't find an option for doing this in bulk for all files though. – Rhyous Jul 14 '22 at 17:05
In addition to Scott's solution, there's a free refactoring tool in Visual Studio Marketplace called Move Type to File.
It can bulk move types to their own separate files, like so:
It also provides a quick shortcut to move a type highlighted by the cursor (default Ctrl + Shift + F1).
Saved me a LOT of manual work...

- 616
- 1
- 8
- 27