I have several interfaces and classes that I have in my business layer project and I want to move them into a brand new project. I am using ReSharper 4.5.2. Is there any way I can do that easily and with no pain? I know about the move type functionality, but it seems like it will only do it within the same project.
You can just drag and drop the files in the solution window, then use ReSharper to automatically add the references and fix any namespace issues.
I've done it - it's not as 1-operation as the move type operation, but it's still very fast.
FYI - ReSharper 5.0 Beta 2 now supports this, directly, by right clicking on a file in the solution window, and choosing Refactor > Move.
In the current version of ReSharper, the Move to Folder refactoring handles this fine:
- Select the files in Solution Explorer or the type in the code editor.
- Open the context menu (right-click or press Context Menu on your keyboard).
- Select Refactor.
- Select Move.
It's not as convenient as drag-n-drop, but it still does everything in one operation across multiple files.
To Elaborate on the accepted answer & comments here there's a simpler way.
Like @Dan Appleyard stated, you can use SHIFT+Drag to "Move" the file instead of "Copy", this will also trigger (in ReSharper 5+) the new project to be added to the references where needed.
Once you've done this go to the folder the moved file is in and choose Right Click -> Refactor -> Adjust Namespaces
. This will correct the namespace the files live in to match the project/folder structure and will go put all the required using
directives in all the files in the entire solution.
© 2022 - 2024 — McMap. All rights reserved.