About a month ago Microsoft released Visual Studio 2008 and this new version features a host of improvements in the Html designer. The Html designer in Visual Studio 2005 has always been quirky to say the least and in Visual Studio 2008 Microsoft has replaced the IE based control with a completely new engine that is essentially the same as the Expression Web editor. There are a host of enhancements from a richer designer experience, to split view as well as much improved Html Intellisense.

I've been using VS 2008 for a few months now almost exclusively for my .NET code and also for West Wind Web Connection development and it's been an improved experience over Visual Studio 2005. The changes aren't drastic especially from the West Wind Web Connection point of view, but there's enough to make opening VS 2005 and working with it feel a little antiquated already <s>...

Please note that all of the features described here should also apply to Visual Web Developer 2008. The only difference for West Wind Web Connection development is the fact that the West Wind Web Connection Visual Studio Add-in cannot run in Visual Web Developer as Microsoft has disabled Add-in support in the Express editions. For West Wind Web Connection Development purposes the most basic version of Visual Studio (Standard) can be used comfortably to get the full feature set required to build West Wind Web Connection applications (including Add-in support).

Let's take a quick tour of things that of interest to West Wind Web Connection developers.

Changes for Visual Studio 2008

First off a  note for a change that was required in order for West Wind Web Connection pages to render properly in the designer in VS 2008. Specifically the new designer tries to place a <form> tag BEFORE any other controls defined on the page - even if the <form> tag already exists. This caused some problems with the way the default West Wind Web Connection <ww:wwWebPage /> marker control works. Here's how it worked pre-VS 2008:

<%@ Page Language="C#" %>
<%@ Register Assembly="WebConnectionWebControls"
            Namespace="Westwind.WebConnection.WebControls"
            TagPrefix="ww" %>
 
<ww:wwWebPage GeneratedSourceFile="weblog/default_page.prg" 
              ID="Default_Page" />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

...

The wwWebPage control sits at the top of the page right after the @Page and @Register directives. It's the marker West Wind Web Connection uses to delineate the page content and to hold the values for the Classname (ID) and the GeneratedSourceFile which is where the PRG file with the generated and your custom code is stored.

Well, Visual Studio 2008 will place a <form> control IN FRONT of this control if you insert any new controls into the page. Since West Wind Web Connection ignores anything preceeding the <wwWebControl /> on the page the page ends up without a form tag and boom it won't run correctly. Yes this is a bug and is being looked at by Microsoft for possible change in the future.

To accomodate this problem, as of West Wind Web Connection 5.30 you can now specify the ID and GeneratedSourceFile tags as part of the <%@ Page > directive instead:

<%@ Page Language="C#"
    ID="WebLogDefault_page" 
    GeneratedSourceFile="weblog\WebLogDefault_page.prg" 
%>
<%@ Register Assembly="WebConnectionWebControls"
            Namespace="Westwind.WebConnection.WebControls"
            TagPrefix="ww" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

...

which solves the problem. Basicly you can move the ID and GeneratedSourceFile tags to the @Page directive and remove the <ww:wwWebPage /> control from the page. The behavior of this new syntax is identical as before, but the page is no longer affected by VS's moving of the <form> tag.

Lest you be thinking that VS 2008 is moving around all sorts of page content - it doesn't. As far as I can tell the new designer/markup editor is very good about otherwise not touching markup already on the page unless you explicitly reformat.

As it turns out I actually prefer to have these tags defined in the @Page tag, because it's the standard way that this is done in ASP.NET. <shrug> Note that the VS Editor will throw an error into the Error dialog as the ASP.NET scheme doesn't include the ID and GeneratedSource properties. This is not a problem - you can safely ignore this error (and any other errors like embedded FoxPro code expressions).

Note that both the old and the new syntax work when running your code, so you don't have to change existing pages although if you're using VS 2008 you'll likely have to do this eventually as you edit the pages.

Editor Improvement

Perhaps the most visible change to Visual Studio is the new Html designer which supports split view and a considerably faster view switching engine. Although initial startup is slower, once pages have been loaded switching views between markup/split and design view are very fast (use F7/Shift F7 with the keyboard for quick access). Speed of switching between views is a big time saver - actually many times I don't even switch as I tend to run in split view and have both editor and designer visible at the same time.

Here's a screen shot of split view editing:

HtmlEditingSplitView

Notice that as you are selecting items in the designer the editor moves the cursor immediately to the specified control and you can make changes either via the property sheet or via the markup editor and almost immediately see the changes in the designer.

There are also a number of options on the View | Visual Aids toolbar option that let you do useful things like show margins, padding and borders highlighted in the editor, show an em space ruler, and allow you the ability to hide or show invisible elements in the designer. The whole goal of the designer is to provide a layout experience that's closer to the real thing than previous version of the VS Html designer.

In addition speed of the editor is enhanced. Dropping controls is faster, editing text in pages refreshes quicker and in general the user experience of the new editor is improved. A word of warning though - Visual Studio 2008 is a resource hog so make sure you have gobs of memory (then again memory is cheap:You can get 4 gig under $100 these days!).

Improved CSS Support

There are lots of improvements in CSS support in the Html and markup designer that make it quite a bit easier to work with Css and putting pages together in a more designable fashion. Some of the cool features are shown below in the screen shot:


 

 

CssStuff

Notice that the selected Html element in the page shows div.gridheader which is the element type and it's Css class assigned. On the right are a couple of the style property sheets. The top list shows all the styles that apply and you can hover over any of them to see the actual style definition. The bottom list shows the DOM object hierarchy from the page down to the control along with the CSS classes applied. You can click on any of the entries and it will take you into the stylesheet to that element or Css class. The bottom window also shows all the styles that have been applied to that element through the entire document hierarchy. So cumulative styles show up there and you can see what's applied.

If you've used the FireBug or the IE or FireFox Developer Toolbars this should be familiar - you can quickly get a feel what formatting is applied and which class or style setting is responsible for the current display format.

These dialogs are pretty complex and it takes a little getting used to and finding a view that works for you but once you've got it set it's quite useful for getting page content right.

When selecting CSS classes in code in the markup editor which provides improved Intellisense which pops down a list of all available styles embedded via style sheets:

Intellisense

The same thing is true in the property sheet when using the designer:

CssDropDown

Speaking of the property sheet -  the property sheet is now available in the markup editor consistently so if you're a markup kind of guy you can skip using the designer and use the markup editor while still not giving up the property sheet which often nice to get information entered quickly.

BTW, on a side note: Notice that in the last image the wwErrorDisplay control displays it's icons properly rather than a broken image as was the case prior to West Wind Web Connection 5.30. All controls that render images now render the images properly in the designer as the images are embedded using pure relative URLs. It's the little things that make things more pleasant at times.

JavaScript improvements

VS 2008 includes a host of JavaScript improvements. Unfortunately most of these are targeted at ASP.NET AJAX and its specialized client library and formatting so it's not quite as useful as it might be - support for third party libraries like jQuery and even the more 'traditional' wwScriptLibrary don't work with Visual Studio's new and improved Intellisense features. However, you do get enhanced Intellisense for the global DOM objects and Intellisense works rather well for local functions and variables you define in local pages. The Visual Studio JavaScript debugger also includes many enhancements including much faster attaching and more detailed callstack and property information.

The JavaScript improvements in VS are disappointing - there are definitely much better tools out there like Aptana and I had hoped Microsoft would at least make a show at providing similar features and functionality but no such luck. Still even the minor improvements are welcome and they do definitely help for page level client code.

Not a Do or Die Decision

Overall for West Wind Web Connection development Visual Studio 2008 is not a do or die update. But if you are using West Wind Web Connection and Visual Studio extensively with VS 2005 I think you will really appreciate the editor improvements in VS 2008 and it's probably worth looking into upgrading.

Visual Studio hasn't officially been released and won't be until February presumably for a combined launch of VS 2008, Server 2008 and Vista SP1. But if you have an MSDN subscription you can download it from MSDN today. Visual Web Developer 2008 is also available now and you can download the trial editions which are good for 90 days.