Mike Ormond's Blog

Musings on mobile development and Windows Phone 7 in particular.

Visual Studio 2010 Enhancements for ASP.NET

Visual Studio 2010 Enhancements for ASP.NET

  • Comments 9

I did a session at DevWeek on ASP.NET 4.0 and Visual Studio 2010 and I’ll be doing a similar session on Saturday at WebDD and again in Glasgow on the 2nd of May at Developer Day Scotland. I thought it might be worth distilling some of the content into a few blog posts. Let’s start with VS2010 enhancements for ASP.NET Developers.

1 – Multi-Targeting

Not specific to ASP.NET but a benefit you’ll still enjoy is the extension of VS2008’s multi-targeting capabilities allowing you to target ASP.NET 2.0, 3.5 or 4.0 applications from the VS2010 IDE. That means you can benefit from all the IDE enhancements even when building or maintaining earlier .NET Fx apps.

ASP4_1

2 – Web Designer Snippets

Yes, at last we have snippets (and “surround with”) in the web designer. That means you can either right-click and select a snippet or type the shortcut (such as “tb” for textbox”) and TAB to get the expansion.

There’s a good selection of HTML, ASP.NET and Javascript snippets in there. There are some real crackers in there too such as DOCTYPES:

  eg xhtml11 =>  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

and of course it’s extensible so you can create your own, share them with others etc. They really take a lot typing out of it.

ASP4_2

Another nice thing about snippets is they have some “smarts” about them. So, for example, if I add a required field validator snippet (as below) it will look for a suitable predecessor that I might want to validate and automatically the ControlToValidate property appropriately.

ASP4_3

3 – Javascript Intellisense Enhancements

Further enhancements in VS2010 will see vast performance improvements, particularly with large script libraries and the ability to recognise dynamically generated objects and other techniques used by many Javascript frameworks that the Intellisense engine in VS2008 struggles with. Significant efforts have been made to improve the Intellisense compatibility with 3rd party libraries as well.

4 – Deployment

VS2010 will use MSDeploy to create web packages comprising your application, metadata, IIS settings, SQL Server schema and data, certificates and other dependencies. To read more about MSDeploy I’d suggest checking out the team blog.

One very cool deployment feature in VS2010 is web.config transformations. Each build configuration is given a unique transformation file to allow the web.config to be tweaked for different build configurations. eg  below I have just Debug and Release configurations. The Web.Release.config file contains a set of transformations that will be applied to the web.config during deployment. In my case I have 2 transforms, one replaces the connection string with my production connection string and the other removes the debug attribute from the compilation element thus ensuring my configuration is correct for production.

ASP4_4

If I add a new build configuration as below:

ASP4_5

I get a corresponding web.config transform file which I can opt to base on any existing transform file (or empty).

ASP4_6

That’s a brief overview of some of the new VS2010 features for web developers. The whitepaper “ASP.NET 4.0 and Visual Studio 2010 Web Development Beta 1 Overview” has more details on some of these features. For a good introduction to deployment in VS2010 I’d recommend How does Web Deployment with VS10 and MSDeploy Work?

Page 1 of 1 (9 items)