ReSharper’s Web Path Mapping Explained

One of the many scenarios that ReSharper seeks to address in web projects is a situation where the locations of files during the design of the app are different from the locations where the app gets deployed. This makes life difficult for ReSharper, since it doesn’t know where to go looking for the relevant files. Luckily, the Path Mapping feature lets you configure the locations of those paths.

There are two mechanisms that can both be used to configure path mappings – context actions and explicitly opening the Path Mapping dialog.

When ReSharper sees a path that it doesn’t recognize, it will underline the path with a wavy line, complaining that it doesn’t know where the path is. At this point, pressing Alt+Enter will show you several options for how the situation can be handled:

The first option, Ignore path, simply tells ReSharper to not bother inspecting this particular path wherever it may appear. This is useful in situations where, for example, you are referencing a file that doesn’t yet exist, and might be created later.

The second option is to Set path mapping, i.e. define explicitly how the path is handled.

Once again, there are two options: Substitute replaces a path with a different path, whereas Ignore chooses to ignore the path and is functionally equivalent to the Ignore path context action.

The Path mapping dialog box doesn’t only show up when you use a context action: you can also open it up by selecting the Path mapping element of the properties of the web project you’re working with. Note that we’re talking about the property grid (F4) rather than the tabbed property pages. To bring up the dialog, just press the button next to Path mapping.

Incidentally, the text value next to the button can be one of two possible options – either Custom indicating that some mappings have already been created, or Not set when none have yet been defined. At any rate, just as with the context action, pressing the button brings up the Path mapping window where you can create, delete and change mappings:

We hope you find this feature of ReSharper useful and your experience of developing web applications becomes a little more enjoyable. Develop with pleasure!

Comments below can no longer be edited.

5 Responses to ReSharper’s Web Path Mapping Explained

  1. Avatar

    Martin says:

    May 10, 2013

    this feature is very helpful, but only if the settings is stored team-shared. Is there any possibility to share this setting to other users in the team?

  2. Avatar

    Dmitri Nesteruk says:

    May 10, 2013

    @Martin though this setting doesn’t have an editable portion in ReSharper’s Options, you can still open the options and save them to team-shared, and the web path settings will be correspondingly saved.

  3. Avatar

    Nils says:

    December 6, 2013

    I, too, would love to save this setting team-shared.
    Sadly I don’t get what you’re trying to say.
    “Open the options and save them to team-shared”?
    Could you please clarify?


  4. Avatar

    Dmitri Nesteruk says:

    December 6, 2013

    @Nils sorry for the confusion. At the moment, the web path mapping settings are stored at the project (rather than solution) level in a file ending in .DotSettings.user. What you need to do to get the team to use those settings as well is to rename the file, removing the .user extension and then be sure that you add it to source control. That way, your team will have the path mapping configured for the project, whereas you can continue using your .user file for personal settings.

  5. Avatar

    Phil Dennis says:

    February 22, 2018

    In HTML, spaces in paths and filenames are supposed to be encoded as %20, however ReSharper does not understand this and flags the paths as unrecognized. ReSharper should understand correct encoding of paths in HTML when validating paths.

Discover more