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.
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.
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.
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.
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.
If I add a new build configuration as below:
I get a corresponding web.config transform file which I can opt to base on any existing transform file (or empty).
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?