ReSharper 8.0 Web Help

ReSharper | Refactor | Safe Delete
Alt+DeleteCtrl+R,D or Alt+Delete

If you are going to delete a resource, use the Safe Delete refactoring to ensure that the delete operation is safe. If there are no resource usages found, the resource will be deleted right away. Otherwise, ReSharper will show all resource usages, allowing you to edit the corresponding code. Removing usages marked with the Refactorings__Safe_Delete__error icon, will lead to compilation errors.

Tip

In some situations, this refactoring is included in the list of quick-fixes.

To safe delete resource safely
  1. Set the caret at the resource usage in a code file:
    Resources__Refactorings__Move_Resource_01
    or at the resource name in a .resx file:
    Resources__Refactorings__Move_Resource_03
  2. On the main menu, choose ReSharper | Refactor | Safe Delete or press Alt+DeleteCtrl+R,D or Alt+Delete.
    • If there are no usages of this resource in code files, the refactoring is applied and resource declarations are removed from all .resx files.
    • If there are usages of this resource in code files, the Safe Delete Resource dialog box opens showing all conflicts.
    Resources__Refactorings__Safe_Delete_02
  3. If you have conflicts trying to safe-delete a resource, resolve them manually and click Refresh.
  4. When all conflicts are resolved and disappear from the dialog, click Next to apply the refactoring.

    Note

    If ReSharper finds usages of resource in code files, but you still apply the Safe Delete refactoring regardless of the conflicts, pay attention, that the resource declaration is deleted from resource files, while resource usages are left intact.