Code Inspection and Quick-Fixes in ASP.NET
Various code inspections are available for ASP.NET, including detecting unused import namespaces, unknown symbols and entities, etc. You can set a severity level for each inspection. For more information, see Configuring Code Inspection Settings. To navigate between code issues that ReSharper discovers, use marker bar and status indicator.
If the locations of files in design time are different from the location where the application is deployed, you can use Path mapping to help ReSharper analyze your code.
During code analysis ReSharper detects and highlights symbols that can't be resolved
because the appropriate
directives are missing. Also, it offers an easy way to add such directives and fix the problem.
ReSharper adds a necessary
directive for .NET symbols:
Or a necessary
directive for ASP.NET controls:
For more information, see
Importing Missing Namespaces.
Examples of quick-fixes
ReSharper informs you that the
...and offers to create one.
The method declaration is inserted into the code-behind file or into the current file
depending on web page code model (single-file page model or code-behind page model).
Add Inherits attribute
This quick-fix is specific for ASP.NET directives. The
attribute is used together with
attribute to associate a code-behind source file with a user control or a page.
When the latter is missing, ReSharper suggests a quick fix:
If there is a
control on a content page that is mapped to a missing
on the master page,
ReSharper suggests creating the corresponding
control on the corresponding master page.
attribute is added to the master page: