Simple But Interesting Features of VS2012: Part 1

Introduction

Usually we try and find distinctive function in the new release, but my article is to find simple yet useful features included in VS2012.

Following are the list of features for this article:

Image Thumbnail

In the solution explorer, we can add Images. The moment you bring your pointer on the image you can its thumbnail image. It make easy to identify the images.

Image-Thumbnail-in-VS2012.jpg

Page Inspector
 
When we have nested pages like if in MVC partial pages, in .net pages inside master page, it becomes very difficult to find with part of the code is responsible for the HTML being generated. Here comes another useful feature if for a specific page u want to inspect, and then right click on the page. You will see the option "View in Page Inspector".

Page-Inspector-in-VS2012.jpg

The moment we choose Inspector, we can see the page in this format:

Page-Inspector1-in-VS2012.jpg

Whatever we select in the browser window, its HTML is shown below it and the page responsible for that HTML is shown on the right. Previously we would run the code, then use tools like firebug to inspect it and if there are any changes necessary we must stop the solution, apply the changes and run again to see its reflection. But with this option we can apply changes and see its reflections. For this feature we require IE9.

Color Picker

A feature most of developers need, as its difficult for them to remember the color name, if they get the color picker it's easy to set the color. VS2012 provides a builtin color picker for CSS. Just type # before the color and you will see the color picker. Select any color of your choice and the code is added.

Color-Picker-in-VS2012.jpg

IIS Express

VS2012 has IIS Express as its default server. IIS Express is a lightweight, self-contained version of IIS that contains all the core features of the IIS web server. In Visual Studio 2010 SP1, IIS Express was available as an option that you had to explicitly configure. IIS Express has the following features:

  • It does not run as a service or require administrator user rights to perform most tasks.
  • IIS Express works well with ASP.NET and PHP applications.
  • Multiple users of IIS Express can work independently on the same computer.

For more information visit IIS Express Overview

IIS-Express-in-VS2012.jpg

Tag completion when renaming tags

The HTML Editor has a beautiful facility when renaming a tag. For example if you have added a <div id="div1">Name</div>. After writing that you felt that, instead of div, you must use a span, then the moment you change the div word to span, the closing tag will automatically be changed to </span>. This will help the developers from getting the UI issues because of the closing tag missing.

Extract to user control

When we have a large web page, we can pick some control from the source view and create a user control for it. This helps in improving the readability of the page.

Extract-to-user-control-in-VS2012.jpg

Select the controls-> Right click your mouse and select Extract to User Control. Give the name to your control and the entire line of code will be replaced by one single control.

Extract-to-user-control1-in-VS2012.jpg

Event Handler

The moment we add any ASP control and want to manage its event handler, VS2012 IntelliSense displays <Create New Event>, which creates an event handler in the code view with the right signature.

Event-Handler-in-VS2012.jpg

AntiXSS Library

The AntiXSS Library which was part of .Net 4.0 but was external, now it's being included in 4.5. If your page requires HTML formatting then the page becomes insure and to protect your page from cross-site scripting attacks you need to include AntiXss library.

The AntiXSS library in 4.5 include following external features:

  • HtmlEncode, HtmlFormUrlEncode, and HtmlAttributeEncode
  • XmlAttributeEncode and XmlEncode
  • UrlEncode and UrlPathEncode (new)
  • CssEncode

Multiple browser support

All the browser's installed in your system can be used to test the application. It becomes easy if your application is supporting multiple browsers. You will see the UI in all browsers supported.

Multiple-browser-support-in-VS2012.jpg

Round Tripping

A very important feature, this is required when we are upgrading from an older version to a new version say from VS2010 to VS2012 and you want your project should work in both VS2010 and VS2012. Round Tripping helps to work with existing Visual Studio 2010 projects, it's easy to upgrade a project to VS2012, and we can use both VS2012 and VS2010 at the same time.

Conclusion

I have created a sample application using all the features mentioned above. This is not the end, just the beginning of my exploration of the VS2012 features. It has become really very interesting when trying to go deep in these features and there are many more to explore. I have studied other features related to the data controls, validations. Will surely try to include them in my next extension of the article.

While writing the article, I have referred following site What's New in ASP.NET 4.5 and Visual Studio 2012


Similar Articles