Avoiding Resharper <location> web.config Warnings with MVC and WebAPI

You can change the R# settings so that they are not local to your machine.

  1. In VS, click the RESHARPER menu, then click Manage Options...
  2. Double click the team-shared item (should be the middle one, between This computer and personal).

By changing settings here, it will create a [ProjectName].csproj.DotSettings file in your project. If you check this file into source control, the settings will be shared with other R# users who develop on the project. AFAIK, any setting you can change (for example telling R# that an inspection severity should be different than the default), you should be able to add to the team-shared settings.

As for your web.config error, I have an even bigger beef with R# because when it is enabled, I lose intellisense on web.config and app.config files. You may be able to tell R# to ignore the error with the following, though I'm not sure it is the solution you are looking for because it will ignore all R# issues with the web.config file.

  1. After double-clicking to edit your team-shared settings (described above), click the Settings item under Code Inspection on the left menu.
  2. Click the Edit Items to Skip button.
  3. Under Files and folders to skip when analysing, click Add File....
  4. Navigate to your web.config file and add it.

This tells R# to ignore the entire web.config file when analysing. Again, not sure if this is the solution you want, but it may work to suppress the false suggestions you are seeing.

Update (reply to comments)

You can in fact change the inspection options from the VS context menu. When the Inspection Options dialog comes up with the radio buttons (Do not show - Error), there is a Save To button. Click that to save the settings to your team-shared DotSettings.


I just added this:

  <!-- ReSharper disable WebConfig.RedundantLocationTag -->
  <!-- ReSharper disable WebConfig.WebConfigPathWarning -->
  <location path="api">
    <system.web>
      <authorization>
        <allow users="*" />
      </authorization>
    </system.web>
  </location>
  <!-- ReSharper restore WebConfig.RedundantLocationTag -->
  <!-- ReSharper restore WebConfig.WebConfigPathWarning -->