Search code examples
asp.nethyperlinkresharperhrefautomated-refactoring

How to refactor <link href=" " /> references in ASP.NET pages/views using ReSharper?


I moved a set of ASPX pages to a different folder using ReSharper's Refactor->Move command.

From ReSharper we have:

Move to Folder

This refactoring helps move a class, a file, or a selection of classes or files to another project or folder in solution. When executing the move, ReSharper updates using directives if necessary. Optionally, it can rename namespaces according to the new location and distribute classes being moved to separate files.

After moving those pages, all the links that reference CSS files got broken.

When I open an ASPX page in source view I get something like this:

enter image description here

I think that if it's offering a substitution it already knows where to look for the correct file.

The hint with an interrogation mark helps but I have to open each page and correct link by link.

Isn't there an automated way of correcting all the links with ReSharper 6.0? If the answer is negative, I think there should be such a feature implemented in the Move to Folder command.


Solution

  • I am afraid, answer is negative. Yep, prompted feature is good, not only for Move to Folder refactoring, but for general purpose (for example, cut&paste of files). We thought about it but postponed since UI is not clear (we need a way to indicate such file references, apply updates to them, and cancel, if necessary).