Developing for the web using VS 2010 and .NET 4

Visual Studio 2010 and .NET 4 are packed with new features and enhancements designed to improve developer productivity. Some are small changes and others are more significant. Altogether they deliver a significant gain in productivity.

More and more developers look to the web to be able to build and deliver applications that take advantage of the reach and friction-free capabilities of the web. With Visual Studio 2010 and ASP.NET 4, there are a number of new features to help you do just that. I want to highlight a few of the new features here.

Snippets for HTML, ASP.NET and JavaScript

C# and VB users have used snippets for years to accelerate developer productivity. Now web developers can experience these same productivity gains with their HTML and ASP.NET markup and JavaScript. There are hundreds of new snippets that help you auto-complete common ASP.NET and HTML tags, including required attributes (such as runat="server") and common attributes specific to a tag (such as ID, DataSourceID, ControlToValidate, and Text).

Snippets

RadioButtonList snippet

Dynamic IntelliSense for JavaScript

One of the biggest challenges developers face when coding with dynamic languages such as JavaScript is that types are dynamically being added and changed. This is can render IntelliSense almost useless. In Visual Studio 2010, the JavaScript IntelliSense engine has been redesigned to work smoothly for dynamic types. For example, you’ll now get IntelliSense for types generated by registerNamespace. The engine also adds support for most common JavaScript libraries. Below is an example of IntelliSense for a newly-registered type with a new function.

JavaScript IntelliSense 

Streamlined Web Deployment

Web deployment has always been a very challenging problem for web developers. Application logic, databases, IIS settings, data and configuration transforms all may need to be applied before deployment.

Now, MSDeploy, a new deployment tool, packages all the settings, files and data associated with a web application. These packages can then be deployed to remote sites or archived for future retrieval. The IIS7 management console now includes a wizard to import packages created by MSDeploy.

Visual Studio 2010 seamlessly integrates MSDeploy into the web development workflow and adds commonly-requested features such as automation of web.config transformations to modify common settings (such as web service end points and connection strings) and database deployment before moving from a developer’s machine to a staging or production server. Below is the new simplified publishing dialog:

MSDeploy 

New Application Templates

Getting started with web development can seem daunting for the new web developer. Visual Studio 2010 includes starter web application templates for ASP.NET 4. These templates include everything you need to get started: a master/content pattern for page consistency, menus, login, and CSS style sheets and jQuery for building JavaScript-rich apps. These templates give you get a working web application right from the start so you can get to work adding your own functionality.

CSS Improvements

ASP.NET controls now have a ClientIDMode property that allows you to change how ASP.NET controls generate the ClientID. Knowing the ClientID is particularly important when styling with CSS or writing JavaScript to access the HTML DOM.

The HTML designer in Visual Studio 2010 has enhanced support for CSS 2.1 that provides a more accurate rendering at designtime compared with how the browser will render the page at runtime.

More Screen Real Estate

One of the most valuable commodities in a development environment is screen real estate. Visual Studio 2010 offers an immense array of options developers can customize to optimize their screen real estate and development experience. The Code Optimized Web Profile optimizes these settings to maximize screen real estate and bring the commands most commonly used by the Source View developer to your fingertips. You can choose the Code Optimized Web Profile when you start Visual Studio for the first time or change your profile later using the Tools | Import and Export Settings… menu item.

Code Optimized Profile 

Clean Web.Config

Sometimes less is more. This is one of those features. When ASP.NET was first introduced, a web.config file wasn’t even required. When it was, it often only contained a few entries. As new capabilities were added to ASP.NET, the web.config file grew in size and complexity, making the file more difficult to read and maintain. ASP.NET 4 brings back the minimal configuration file.

URL Routing with ASP.NET WebForms

URL routing is a feature common to MVC projects. ASP.NET 4 supports URL routing for web forms. Now you can define URLs that are meaningful to your app and understandable by users. These simplified URLs also help with search engine optimization (SEO).

Learn More

This is only a sample of the improvements for web developers in Visual Studio 2010. You can see a complete list of new features for web development here.

One More Thing...

If you have been using Visual Studio 2010 Beta 2, we'd like to hear from you. Please take the survey and tell us about your experiences.

Got Feedback?

 

Namaste!