ASP.NET Support in ReSharper 5

Although I mentioned briefly in the past some of the new features ASP.NET MVC features ReSharper 5 supports, I thought it would be a good idea to sum up the main ones in a single post and go into a little bit more detail on them.

 

ASP.NET

ReSharper ‘s support for ASP.NET is not restricted only to MVC.In fact, most of the new features are for general ASP.NET, be it WebForms (also known as Traditional, Classic, For Historical Purposes Only?) or MVC.

 

Go to File Member

As part of the code navigation features of ReSharper, you have the possibility to locate a file member, be it a method, property, class, etc. very easily by using the the Go To File Member (Alt+\) option. You can search instantly and hit Enter to navigate to the specific one. [For the record, I’m using the Visual Studio Keyboard Scheme. If you’re using IntelliJ (why?) go to the web site and download the PDF mapping files.]

 

image

Notice how it it looks for anything that matches the characters introduced, so for instance typing “Exc” would give us all those with the word “Exception”

image

Well you now have this functionality in ASPX, ASCX, ASAX and Web.config files also as of ReSharper 5!

image 

 

The same goes for the File Structure tool Window (Ctrl+Alt+F).

image 

 

Go To Related Files

Many times, an ASPX has references to other files, such as Cascading Style Sheets, Javascript Files, Master Pages and User Controls. You can now navigate to these files efficiently by using the Go To Related Files (Ctrl+Alt+F7)

image

 

Master Pages

Version 5 also adds support for Master and Content Pages. To begin with, we have added support for navigation. Using Go To Declaration (Ctrl+Left Mouse) on the ContentPlaceHolderID will take you from the Content Form/Page to the corresponding ContentPlaceHolder of the Master Page

image

image

If you are in the Master Page, you can navigate to all its inheritors (Shift+Alt+F12)

image

You can also create content place holders from usage. When defining a ContentPlaceHolderID that does not exist, you have the option to create it in the Master Page (Alt+Enter)

image

Last but not least, in a page that uses a master page, you can generate content place holders by pressing Alt+Ins

image 

which in turn will bring up a dialog box for you to pick and choose what you want

image

 

User Controls

You can now navigate to user controls as well as automatically import the correct references.

image

 

File Generation

There are new code generation options for ASP.NET with version 5. By pressing Alt+Ins in the Solution Explorer, we are presented with a popup menu

image

where you can choose from a selection of items to generate. You can also access this menu from anywhere (not only in the Solution Explorer) by now pressing Ctrl+Alt+Ins. This is actually an awesome new addition to ReSharper 5 (Ctrl+Alt+Ins) and it removes even more friction when create new items!

image

We’re asked for a name (which is the base minimum required to create an item) and If the item selected requires more information, then we’ll be prompted accordingly. For example, when creating a WebForm with Master Page, it’s convenient to specify which Master Page we want to use. In this case, once the page has been created, we’ll be given a chance to provide this information

 

image

I have to say, that I love Ctrl+Alt+Ins in ReSharper 5.

 

Refactoring and Assistance

In terms of Refactoring and Coding Assistance there are a few new features. One of them is the auto-update of ending tags. If you have for instance a div tag, and want to change it to span, as you start typing span, the end tag is automatically updated to reflect the changes you’re making live.

image

If you have a series of elements that you want to surround within a tag, you can easily do this by selecting all the elements and choosing Surround with Template (Ctrl+E,U)

 

image

image

image

 

ASP.NET MVC

ReSharper 5 treats ASP.NET MVC as a first class citizen. As such, it now has knowledge of concepts such as Views, Controllers and Action.

 

Navigate to View

For those of you working with ASP.NET MVC, you might have noticed that Views are now underlined in Actions

image

When you click on the View with Ctrl+Left Mouse, you’ll be presented with a dropdown menu

image

Here you have two options. The first is to navigate to the source for the View method (navigation to external sources is another new feature of ReSharper 5). The second option is to go to the View. Although you can navigate to the View in Visual Studio by right-clicking and selecting Go To View, one advantage the underlining adds is that it serves as hint for non-existent views, as you can see in the action below, which doesn’t have a corresponding View file.

image

View discovery also works with named Views. If a named view exists, the string literal will be underlined

image

On the other hand, if it doesn’t exist, it will be highlighted as an error, once again providing you the benefit of discovering any missing views earlier on.

image

 

Action Links

Those of us who have worked with ASP.NET MVC applications, know the problems with using strings when defining ActionLinks. Not only do you run into issues when refactoring, but misspelling an action or controller causes unnecessary pain. Some of us, including myself, have often resorted to using the expression based Actions available in the MVC Futures library.

ReSharper 5 now provides Intellisense, preventing you from mistyping Actions and Controllers

image

Similar to named Views, if you define a non-existing Action, you will get it highlighted. The difference here is that by pressing Alt+Enter, ReSharper will create the Action for you (create based on usage)

image

image

 

And much like Views, you can now navigate to Actions and Controllers from an ActionLink by choosing Go To Declaration (Ctrl+Left Mouse) on the Action and Controller respectively.

image

 

User Controls

Navigation is also provided for User Controls

image

as well as Intellisense

image

 

Summary

I’ve outlined some of the main features that ReSharper 5 brings to the table in regard to ASP.NET. There are many smaller features that you can discover eventually as you play with it more. If you haven’t yet, make sure you download 5 from JetBrains. Don’t forget to follow ReSharper on Twitter if you want tips, tricks and latest info.


Posted 01-20-2010 6:04 PM by Hadi Hariri

[Advertisement]

Comments

sergiopereira wrote re: ASP.NET Support in ReSharper 5
on 01-20-2010 12:43 PM

Good stuff. I shall upgrade ASAP.

David Kemp wrote re: ASP.NET Support in ReSharper 5
on 01-21-2010 6:09 AM

re: If you’re using IntelliJ (why?)

I use this because I've been using R# forever, and originally there wasn't a choice over keyboard mappings, so I learnt the Intelli-j ones and now CBA to relearn them just because VS started playing catch-up

Hadi Hariri wrote re: ASP.NET Support in ReSharper 5
on 01-21-2010 6:27 AM

@David,

It was a joke :). I appreciate that a lot of people are used to the IntelliJ setup. In fact I think it was Howard that mentioned that it would be a good idea to have a global key to change schemes. Would help pairing up with devs using different layouts.

renantech wrote re: ASP.NET Support in ReSharper 5
on 02-07-2010 8:00 PM

asp.net 2010 version is great because of the improve features and easy to use.

social bookmarking submit wrote re: ASP.NET Support in ReSharper 5
on 01-18-2013 2:44 AM

4Tpa1S Muchos Gracias for your article.Really thank you! Want more.

buy generic cialis wrote re: ASP.NET Support in ReSharper 5
on 01-27-2013 2:54 PM

H2waEu Muchos Gracias for your blog.Thanks Again.

buy viagra online wrote re: ASP.NET Support in ReSharper 5
on 02-02-2013 7:52 PM

RBBPz2 Appreciate you sharing, great article. Keep writing.

buy viagra online wrote re: ASP.NET Support in ReSharper 5
on 02-03-2013 1:30 AM

oly9lT I am so grateful for your article.Much thanks again. Keep writing.

buy imitrex online wrote re: ASP.NET Support in ReSharper 5
on 02-15-2013 4:23 PM

MEfNAF Thanks a lot for the blog article.Much thanks again. Awesome.

viagra online wrote re: ASP.NET Support in ReSharper 5
on 03-03-2013 10:04 PM

YdDRqt Thanks so much for the blog. Keep writing.

bookmaring service wrote re: ASP.NET Support in ReSharper 5
on 03-13-2013 10:32 PM

mqSIH4 Looking forward to reading more. Great blog post. Really Cool.

social bookmarking service wrote re: ASP.NET Support in ReSharper 5
on 04-03-2013 9:10 AM

MuRSEy I cannot thank you enough for the article.Really thank you! Really Cool.

comedy shirts wrote re: ASP.NET Support in ReSharper 5
on 04-05-2013 3:40 PM

Thanks for sharing, this is a fantastic blog article.Really looking forward to read more. Fantastic.

buy social bookmarks wrote re: ASP.NET Support in ReSharper 5
on 04-07-2013 5:45 PM

JrvfQu Thanks for sharing, this is a fantastic blog post.Really thank you! Fantastic.

buy social bookmarks wrote re: ASP.NET Support in ReSharper 5
on 04-12-2013 9:29 AM

IG7scN Great blog post.Really thank you! Cool.

social bookmarking service wrote re: ASP.NET Support in ReSharper 5
on 04-15-2013 11:00 PM

25cMmT I think this is a real great blog article.Much thanks again. Really Cool.

buy social bookmarks wrote re: ASP.NET Support in ReSharper 5
on 04-20-2013 8:12 AM

yG5EMY A round of applause for your blog.Really looking forward to read more. Cool.

slr lenses wrote re: ASP.NET Support in ReSharper 5
on 05-14-2013 12:22 AM

UxMtva Very good article post.Much thanks again. Keep writing.

awesome moldavian news wrote re: ASP.NET Support in ReSharper 5
on 08-04-2013 10:16 PM

j7SDFG Thank you for your article post.Much thanks again. Awesome.

awesome linkbuilding site wrote re: ASP.NET Support in ReSharper 5
on 09-30-2013 7:15 PM

VTJdtJ I truly appreciate this blog.Much thanks again. Fantastic.

check out these guys! wrote re: ASP.NET Support in ReSharper 5
on 10-15-2013 6:18 PM

XJuBGI Muchos Gracias for your article post.Much thanks again. Great.

top seo guys wrote re: ASP.NET Support in ReSharper 5
on 10-24-2013 7:06 PM

EjY3Xt Thanks again for the blog.Thanks Again. Really Great.

crorkservice wrote re: ASP.NET Support in ReSharper 5
on 07-18-2014 9:01 AM

9xEog0 I truly appreciate this blog article.Much thanks again. Want more.

Add a Comment

(required)  
(optional)
(required)  
Remember Me?

About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Subscribe
Google Reader or Homepage

del.icio.us CodeBetter.com Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl CodeBetter.com Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of Devlicio.us
Red-Gate Tools For SQL and .NET

NDepend

SlickEdit
 
SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
LiteAccounting.Com
DevExpress
Fixx
NHibernate Profiler
Unfuddle
Balsamiq Mockups
Scrumy
JetBrains - ReSharper
Umbraco
NServiceBus
RavenDb
Web Sequence Diagrams
Ducksboard<-- NEW Friend!

 



Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers

 

Community Server (Commercial Edition)