Continuing
on our odyssey exploring the features of Visual Studio 2010, we turn
our attention to the New Project dialog box. You noticed a difference no
doubt, but may not be aware of just how much it has changed. Sit back, relax, open up Visual Studio 2010 and follow along as we dive into the details.
Press CTRL + SHIFT + N to bring up the New Project dialog box shown in Figure 1.
How many times have you come here only to do exactly the same thing you
did in Visual Studio 2008? Most people do. Look again at this dialog
and notice, in particular, the left-hand side that shows project
template organization.
Figure 1: The New Project dialog box in Visual Studio 2010.Recent Templates
Much
like Pavlov’s famous experiment, when we see the New Project dialog we
immediately just dig through the Installed Templates, find our project
template of choice, and move on. Stop and ask yourself a simple
question: “How many templates do I actually use?” I’ve asked thousands
of developers the number of templates they use every day, week, month,
and year. The answers are pretty consistent across the board-hardly any
of them use more than 3-5 project templates in any given year.
It
makes sense when you think about it. If you are a web developer then
you will most likely stick with one of the web project templates over
and over again. Granted you may use that template several hundred times but it is only one project
template. So why should you dig though a sea of installed templates
just to get to the one that you use all the time? The simple answer is you shouldn’t. Figure 2 shows the new Recent Templates section.
Figure 2: Recent Templates.
The
concept is both simple and elegant: just show the last five most
recently used templates. That’s it. No more digging through all the
installed templates to find the ones you use most often. I’ve found that
most people, once they learn of this feature, just stay in this area
most of the time except for the rare times when they need a template not
listed here already.
Searching Project Templates
Even
with the Recent Templates section you will still need to occasionally
dig into areas like the Installed Templates to find one that you need.
Don’t go blindly looking for the templates, just search for them
instead! Figure 3 shows the new search area that you can use to find project templates.
Figure 3: Search Templates.
The
usage is pretty straightforward but requires a little orientation.
Let’s say you are searching for web projects. Simply type in the word web and see the results show in Figure 4.
Figure 4: Search Templates result.
Unfortunately it shows all languages and we just want to see the Visual Basic templates. No problem! Just type vb (case doesn’t matter) anywhere in the search to have it filter by language as shown in Figure 5.
Figure 5: Search Templates result filtered by language.
All
languages have shorthand syntax to make it easy to search them like C#,
C++, and F#, for example. There is one problem with this example
however: it isn’t really necessary. You could pretty much get the same
result just by expanding the Visual Basic node and going to the Web
section in the New Project dialog box as shown in Figure 6.
Granted it’s not an exact match. Visual Web Part isn’t in the list in Figure 6 but it’s pretty close. So while there is some value to using search with installed templates, I believe the real value is when you are dealing with a set of unknown templates.
Figure 6: Web section in Visual Basic project templates.Online Templates
By now hopefully you have heard of the Visual Studio Gallery which can be found at:
Essentially
this is a collection of Microsoft and community-created content to
enhance your Visual Studio experience. Fortunately we just use Online
Templates in the New Project dialog box as shown in Figure 7 to get access to the project templates from the Visual Studio Gallery.
Figure 7: Online Templates.
As
you can see the templates here are organized into broad categories
under the Templates node. Lucky for us we don’t need to root around in
here looking for specific templates. Just search for your desired
template! This is where the Search really shines in my opinion.
Let’s put in C# WPF (again, case doesn’t matter) in the search area and see the result we get shown in Figure 8.
Figure 8: Online Templates search result.
Now
we have a filtered list of templates that mention WCF in them or are
related to WCF in some way. With that said, be careful about filtering
by language in this area. There tends to be a lot of false positives
when narrowing down by language. In this example I encountered three
non-C# templates in the search result.
Sorting Templates
Last
on the list of new features in the New Project dialog box is the Sort
By drop-down box. The options here change depending on context. Figure 9 shows the options for Installed Templates available to us.
Figure 9: Sort Options for Installed Templates.
There
are many people who don’t like the default sort order for templates.
Personally I never had a problem with it but if you want to change the
order you can now sort ascending or descending as well.
Also, based on your context, this list will change. Figure 10 shows the sort options for Online Templates.
Figure 10: Sort Options for Online Templates.
More,
and different, choices present themselves so we can arrange the
templates by the most appropriate information. Generally speaking, I
tend to stick with Highest Ranked or Most Downloads as a good indicator
of the better templates to use.
Final Thoughts
Clearly
there are many new features for you to explore in the Visual Studio
2010 New Project dialog box. It’s time to go beyond what you were used
to in prior versions of Visual Studio and leverage these great
productivity enhancements. Enjoy!
Mr. Zain Naboulsi Jr
No comments:
Post a Comment