ASP.NET and ASP.NET MVC Tools
ReSharper helps your efficiently work with ASP.NET and ASP.NET MVC projects, including markup files, with a whole pack of code analysis, coding assistance, navigation, and code generation features. Some of them work in web applications exactly the way they do in C# or VB.NET projects; others are fine-tuned for specific requirements of web development.
Code Analysis and Assistance
Code Inspections and Quick-Fixes
Whenever you work with C# code used in ASP.NET markup and in code-behind files, you enjoy the complete ReSharper feature coverage, including the whole range of code inspections and quick-fixes. In addition, there are code inspections and quick-fixes that are ASP.NET-specific: for example, ReSharper detects unused import namespaces, unknown symbols and entities in aspx pages.
Marker Bar and Status Indicator are available in ASP.NET markup files as well, to help you navigate between code issues that ReSharper discovers.
ReSharper provides 25 context actions to help you in common ASP.NET markup scenarios.
For example, ASP.NET context actions enable you to:
- Replace, collapse or remove tags.
- Convert HTML entities.
- Create events and properties.
- Insert table columns and rows.
- Move HTML code to resource files.
- Add code-behind files.
When you inline code render blocks in your aspx pages using C# or VB.NET, ReSharper's syntax highlighting helps you:
- Easily spot action and controller names in ASP.NET MVC calls. (Read more about this and other ReSharper features for ASP.NET MVC.)
- Take advantage of regular syntax highlighting for C# and VB.NET code.
Import Symbol Completion helps you reference non-imported user controls without registering them in advance: ReSharper will generate the Register directive automatically.
Auto-Import and Auto-Registering
Speaking of auto-registering, ReSharper will automatically register your user control as soon as you've used it...
... and automatically import any namespace as soon as you've used a type that belongs to it, just like it does in other types of projects:
Other Coding Assistants
ReSharper will auto-insert a matching closing tag as soon as you've entered an opening tag, or a closing quote after you've entered an opening quote for an attribute value. More than that, such matching delimiters are highlighted when you put the caret on either of them.
When you have a deeply nested tag hierarchy, rely on Extend/Shrink Selection to select it from a narrow scope to a wider scope, and vice versa. When you've made a selection, you can move it up/down (for tags), or left/right (for attributes).
If you have HTML markup in your aspx pages that needs to be localized, you can select it, press Alt+Enter, and move the string to a resource file. However, that's only a fraction of ReSharper's internationalization capabilities.
Navigation and Search
Much of ReSharper's navigation feature pack is available in ASP.NET.
For example, if you want to get an overview of markup items in your currently opened aspx file, press Ctrl+Alt+F to display the File Structure tool window. File Structure derivatives, such as Go to File Member, Go to Next/Previous Member, and Go to Containing Declaration, are at your disposal as well.
Other navigation actions that come handy in ASP.NET projects include Go to Declaration, which is especially useful for navigation to user controls and master pages from references, and Go to Usages of Symbol for navigation from ContentPlaceHolder tags to their Content counterparts, or from a master page reference to any web forms that use it:
Code Generation and Templates
Live templates (Ctrl+E, L) for ASP.NET speed up creating new controls, script blocks, tags, and attributes:
Surround templates (Ctrl+E, U) help wrap text or code with tags, links, or foreach blocks:
File templates (Ctrl+Alt+Ins) facilitate creating new web forms, user controls, and master pages:
In addition, ReSharper is able to generate Content tags in markup pages based on ContentPlaceHolder tags defined in a referenced master page. Press Alt+Ins in the text editor to invoke this generation feature:
ASP.NET MVC Support
In addition to general ASP.NET features described above, ASP.NET MVC developers get an additional pack of framework-specific functionality that includes — both for ASPX and Razor view engines:
Note on shortcuts
All keyboard shortcuts provided in the "Features" section are taken from 'Visual Studio' keyboard scheme. For details on ReSharper's two default keymaps, see Documentation and Demos.