JetBrains Rider 2017.3 Help

Move to Folder refactoring

Ctrl+R, O

This refactoring helps you move one or several types or files to another project or folder anywhere in your solution. If necessary, the refactoring will create the new target folder for you. All imports that the moved type(s) require are fixed in the new location. All imports that are no longer necessary are removed from the original file(s).

Note that if you are moving types to another project, there may be missing project references for namespaces used in the moved types. In this case, you will have to add the missing references manually

To move types or files to another folder

  1. Select types that you want to move in one of the following ways:
    • In the editor, set the caret at the name of a type.
    • Select a type in the Structure window.
  2. Do one of the following:
    • Press Ctrl+R, O and then choose Move To Folder
    • Press Ctrl+Shift+R and then choose Move To Folder
    • Choose Refactor | Move To Folder in the main menu.
    The Move To Folder dialog will open.
  3. In the Target folder field, specify the folder where the selected items should be moved:
    • Start typing the name of the target folder or the target project and use the completion suggestions to select it.
    • If the target destination is not valid, e.g. other language is used in the target project, or a solution folder is selected, then the red icon appears. This means that you need to change the destination.
    • If you need to create a new folder in the selected destination, type \[folder name] and click Create this folder.
  4. If you move several types, you can select Preserve hierarchy of folders and file names to leave the structure of original files folders "as is" during the refactoring, or select Put classes into separate files to put each type into a separate file with the appropriate name.
  5. The namespace imports in the moved items are fixed automatically according to the new location. If you want to adjust namespaces manually, clear the Fix namespaces check box.
  6. Select Allow change internal visibility to public when it is required to change the private, protected and internal visibility restrictions so not to break the existing type usages.
  7. By default, all types from all selected items will be moved. If necessary, you can clear check boxes for the types that you want to leave in the original location.
  8. To apply the refactoring, click Next.
  9. If no conflicts are found, JetBrains Rider performs the refactoring immediately. Otherwise, it prompts you to resolve conflicts.
JetBrains Rider. Move to Folder refactoring
Last modified: 19 April 2018

See Also

Procedures: