BusinessRx Community

Dedicated to the advancement of software, technology and the people who devote their lives to it.

Welcome to BusinessRx Community Sign in | Join | Help
in Search

BusinessRx Reading List

These blog entries are written by industry experts and leaders. We consider this content to be a good read for any software developer or web technologist.

November 2007 - Posts

  • .NET Web Product Roadmap (ASP.NET, Silverlight, IIS7)

    Last week we shipped Visual Studio 2008 and .NET 3.5.  This release is a big one for .NET, and delivers a ton of new capabilities and improvements for web, client, office and mobile development.

    Over the next few months we'll be delivering a series of additional products that build on top of this VS 2008 and .NET 3.5 foundation, and make .NET development even better.  Below is a road-map of some of the upcoming initiatives and releases for .NET web development that my team is currently working on for the months ahead:

    Releasing the Source Code for the .NET Framework Libraries

    We announced last month that we'll provide the ability for developers to download and browse the source code of the .NET Framework libraries, as well as enable integrated source debugging of them using Visual Studio 2008.  You can learn more about this in my blog post here.

    We are finishing up the final deployment of the source servers that host this now, and will be publishing instructions on how to enable the integrated debugging experience within Visual Studio 2008 shortly.  I'll blog detailed steps on how to turn this feature on once it is available.

    ASP.NET 3.5 Extensions Release

    VS 2008 and .NET 3.5 include a ton of new features for ASP.NET development.  We are planning to deliver even more ASP.NET functionality next year with a "ASP.NET 3.5 Extensions" release.  The first public preview of this will be available for download next week on the web.

    Next week's ASP.NET 3.5 Extensions preview release will include:

    • ASP.NET MVC: This model view controller (MVC) framework for ASP.NET provides a structured model that enables a clear separation of concerns within web applications, and makes it easier to unit test your code and support a TDD workflow.  It also helps provide more control over the URLs you publish in your applications, and more control over the HTML that is emitted from them.  You can learn more about it from Part 1 of my ASP.NET MVC Tutorial series.  I'm hoping to find time this weekend to write and post Part 2 of the series.
    • ASP.NET AJAX Improvements: New ASP.NET AJAX features in the ASP.NET 3.5 Extensions release will include better browser history support (back/forward button integration, and server-side history management support via a new <asp:history> server control), improved AJAX content linking support with permalinks, and additional JavaScript library improvements.
    • ASP.NET Dynamic Data Support: The ASP.NET 3.5 Extensions release will deliver new features that enable faster creation of data driven web sites.  It provides a rich scaffolding framework, and enables rapid data driven site development using both ASP.NET WebForms and ASP.NET MVC.
    • ASP.NET Silverlight Support: With the ASP.NET 3.5 Extensions release we'll deliver support for easily integrating Silverlight within your ASP.NET applications.  Included will be new controls that make it easy to integrate Silverlight video/media and interactive content within your sites.
    • ADO.NET Data Services: In parallel with the ASP.NET Extensions release we will also be releasing the ADO.NET Entity Framework.  This provides a new modeling framework that enables developers to define a conceptual model of a database schema that closely aligns to a real world view of the information.  We will also be shipping a new set of data services (codename "Astoria") that make it easy to expose REST based API endpoints from within your ASP.NET applications.

    Silverlight 2.0 Release

    Two months ago we shipped Silverlight 1.0 for Mac and Windows, and announced our plans to deliver Silverlight on Linux.  Silverlight 1.0 is focused on enabling rich media scenarios in a browser, and supports a JavaScript/AJAX programming model.

    Next year we will be releasing a major update of Silverlight that focuses on enabling rich Internet applications.  This release will include a cross-platform, cross-browser version of the .NET Framework, and will enable a rich .NET development platform in the browser.  Earlier this year we shipped an early Alpha containing some of the basic functionality of the release.  Our next public preview will add considerably to this feature set.  Some of the new .NET specific features in the next public Silverlight preview will include:

    • WPF UI Framework: The current Silverlight Alpha release only includes basic controls support and a managed API for UI drawing.  The next public Silverlight preview will add support for the higher level features of the WPF UI framework.  These include: the extensible control framework model, layout manager support, two-way data-binding support, and control template and skinning support.  The WPF UI Framework features in Silverlight will be a compatible subset of the WPF UI Framework features in last week's .NET Framework 3.5 release.

    • Rich Controls: Silverlight will deliver a rich set of controls that make building Rich Internet Applications much easier.  The next Silverlight preview release will add support for core form controls (textbox, checkbox, radiobutton, etc), built-in layout management controls (StackPanel, Grid, etc), common functionality controls (TabControl, Slider, ScrollViewer, ProgressBar, etc) and data manipulation controls (DataGrid, etc).

    • Rich Networking Support: Silverlight will deliver rich networking support.  The next Silverlight preview release will add support for REST, POX, RSS, and WS* communication.  It will also add support for cross domain network access (so that Silverlight clients can access resources and data from any trusted source on the web).

    • Rich Base Class Library Support: Silverlight will include a rich .NET base class library of functionality (collections, IO, generics, threading, globalization, XML, local storage, etc).  The next Silverlight preview release will also add built-in support for LINQ to XML and richer HTML DOM API integration.

    Previously we've been referring to this .NET-enabled Silverlight release as "Silverlight V1.1".  After stepping back and looking at all the new features in it (the above list is only a subset - there are many more we aren't sharing yet), we've realized that calling it a point release doesn't really reflect the true nature of it.  Consequently we have decided to change the name and refer to it as "Silverlight V2.0" going forward.

    We will be releasing a Beta of Silverlight 2.0 in Q1 of 2008.  This Beta will support a Go-Live license that enables developers to begin building and deploying Silverlight 2.0 applications.

    We will also be releasing a free Visual Studio 2008 tools update that provides great Silverlight 2.0 tools support within Visual Studio 2008, and enables developers to easily build Silverlight applications using any .NET language.  We will be supporting Silverlight development with both the Visual Studio 2008 Standard/Professional products, as well as with the free Visual Studio 2008 Express editions.

    I'm going to be starting a new blog tutorial series in a few weeks that discusses how to build Silverlight 2.0 applications, and show off the new features in more depth.  Stay tuned for more details soon.

    IIS 7.0

    Early next year we'll ship the final release of IIS 7.0 as part of the Windows Server 2008 release.  As I've blogged about in the past, IIS 7.0 is a major update of our web-server stack, and introduces a significantly new and improved extensibility, configuration and administration architecture. 

    One of the really cool things about IIS 7.0 is that it is all nicely integrated with the .NET Framework, and enables you to use any .NET language to extend and customize the server.  You can now easily do things in VB and C# that previously required writing a pretty gnarly C++ ISAPI.  The deployment, management and administration of web applications on the server is also now nicely unified across IIS and ASP.NET.

    We will also shortly begin sharing details of a new web application deployment framework for IIS that enables you to easily automate the deployment of web applications on either a single server or across a web farm of machines.  It will make it easy to version your web applications (including allowing you to quickly roll back to previous versions), as well as automatically provision them across multiple servers.  It also enables the full automation of deployment tasks (including via both command-line and PowerShell scripting APIs).  The combination of IIS7 with this web deployment framework will enable you to deploy and scale your ASP.NET server applications better than ever before.

    Summary

    Last week's VS 2008 and .NET 3.5 release was a huge step forward for .NET development.  The release not only delivered a ton of great new language, runtime and tool features, but even more importantly provided a really solid foundation that we'll be building upon in the months and years ahead.  Stay tuned to my blog for more details about each of the above releases.

    Hope this helps,

    Scott

  • VS 2008 Compatibility with Older VS 2005 Add-in Packages

    I've helped a few people over the last week who have run into issues with VS 2008 where it would immediately crash when the IDE was launched, or upon creating new projects (usually failing with a "Visual Studio has encountered an unexpected error" dialog).

    After debugging the issues, it turned out that they were caused by an older VS 2005 add-in that people had installed on their machines that wasn't compatible with VS 2008.  In each of these specific cases it was an older version of the VisualSVN source control utility (note: Version 1.3.1 of VisualSVN works fine with VS 2008 - but older versions have problems).

    By default when you install VS 2008 on a machine that has VS 2005 on it, setup will use your existing settings to configure VS 2008, and will import your current VS 2005 preferences and add-in packages.  If you see any crashes or issues (especially upon first launching the IDE) it could be that they are caused by one of your older add-in packages having some compatibility issue with VS 2008.

    If you run into a situation like this, one option to try is to launch VS 2008 in "safemode".  This will launch the IDE with add-in packages disabled, and provides you with a good way to determine whether it might be an add-in causing the problem.  You can launch VS 2008 in safemode by passing the /safemode switch to the VS 2008 devenv process from the command-line:

    If you discover that the problem you encountered is related to an add-in, you can use the Tools->Add-In Manager menu option to disable the add-in within the IDE.

    As a general best practice, I'd recommend that you always keep close track of the add-ins you have installed with Visual Studio, and make sure to periodically check for updates of them (especially when upgrading to VS 2008).  If you do ever report an issue with VS - please also make sure to detail the add-in packages you have installed, as this can help a lot in our investigations.

    Hope this helps,

    Scott

    P.S. Ilya Ryzhenkov from JetBrains recently published a blog post that details the plans to update the popular ReSharper add-in for VS 2008.  You can read it here.

  • Deploying my Rails app

    I am finally ready to deploy the rails application I have been working on for the last couple of months (no link yet, couple more weeks of bug fixes). Instead of going with a shared account, which I have never liked for all the obvious reasons, I went with a dedicated Linux box at CrystalTech. I chose CrystalTech because I have always used them for my windows dedicated boxes and have had a great experience so far.

    Of course I didn't really think about the fact that I hadn't really used Linux much in the the last 10 years. Thankfully CrystalTech handles installing most of the necessary stuff like Apache, MySQL, VSFTP, etc, etc. So I just had to install rails and get it all setup. It took a little longer than I expected, and I learned a fair amount about VI and Apache in the process, but I finally got it all setup and working.

    The only way I got it done was with some great help from the Raleigh.rb mailing list, and mixing the instructions here and here. I now have Apache serving up all the static files and a mongrel cluster (using Apache's mod_proxy_balancer) to handle the rails work. I couldn't be happier!

    -James

  • Watin Test Recorder: Watin Model Style

    Here is a sneak preview of something I have been working on:

    Watinrecorder

    Trying to make it easier to create the Watin Models I described in my Watin Testing Pattern post.

    -James

  • Silverlight 1.1 Tools Alpha for Visual Studio 2008 Available for Download

    This afternoon we released an updated version of the Silverlight 1.1 Tools Alpha that works with the final release of Visual Studio 2008.  You can download it for free here.

    The tools alpha refresh released today has the same feature-set as the Silverlight Tools Alpha add-on which was previously available for Visual Studio 2008 Beta2 (it has simply been updated to work with the final VS 2008 release).  This feature-set includes basic Silverlight 1.1 project system support, XAML markup editing and intellisense support, debugging support, Expression Blend project compatibility, and VB and C# code-behind intellisense.  You can find quickstart tutorials that detail how to use these features here.

    The next public preview of Silverlight will include a ton of new runtime features, as well as a significantly enhanced VS 2008 tooling support.  I'll be blogging more details about this shortly.

    Hope this helps,

    Scott

  • Answers to a few VS 2008 Trial Edition, TFS 2008, and SourceSafe Questions

    Below are some answers to a couple of questions about the recent VS 2008 release that I've seen the last few days:

    When will the trial edition of VS 2008 Professional be available for download?

    We shipped a free trial edition of VS 2008 Team Suite on the web last week.  You can download it here.  We are hoping to publish the free trial edition of VS 2008 Professional on the web later this week.  Both can be used for free for 90 days after you install them.  If you aren't a MSDN subscriber and want to get VS 2008 immediately this is a good way to get started.

    Can you convert a trial edition installation of VS 2008 to a purchased edition, or do you need to reinstall it?

    Commercial versions of VS 2008 ship with a PID product key.  You can upgrade a VS 2008 trial edition install to use this PID without needing to reinstall VS 2008.  You can do this in one of two ways:

    1) Pull up VS Setup from the add/remove programs tool in Windows.  Enter the PID of the license you purchased and your upgrade is complete (no DVD or separate setup required).

    2) Launch setup from the DVD you purchased.  If it is the same version of the VS trial edition, there is an option with it to enter the full PID to upgrade the trial edition.

    Where can you find a standalone VS 2008 Team Explorer installer?

    VS 2008 Team Explorer can be used as a standalone rich client for accessing VS 2008 Team Foundation Server.  You can download a copy here.

    Can you use VS 2008 with TFS 2005?  Can you use VS 2005 against TFS 2008?

    Yes - you can use VS 2008 clients against Team Foundation Server 2005.  Likewise, you can use VS 2005 clients against Team Foundation Server 2008.  You can download a 90 day free trial edition of TFS 2008 here.

    If you are using TFS today (or thinking about it in the future) you should also make sure you are subscribed to Brian Harry's excellent blog here.  Make sure to check out his blog post covering TFS 2008 features, as well as his blog post covering TFS 2008 Installation Questions.

    What is the status of using Visual SourceSafe with VS 2008?

    We are working on an update for Visual SourceSafe 2005 to make it work with VS 2008.  We had originally planned to have it available last week, but found a last minute bug that has delayed it a few weeks.  We are now planning to make it available in a few weeks.  Brian Harry has more details on this in his blog post here.

    Hope this helps,

    Scott

  • Can I Replace My JavaScript Code With a Silverlight App?

    Silverlight

    Some say DOM scripting will end in fire,
    Some say in Silverlight.
    Still others say with much desire,
    That either will suffice.

    (apologies to Robert Frost).

    The arguments I hear go like this: if a developer can build on a cross-platform CLR with a diverse selection of languages and still interop with the browser, than why would the developer stoop into the primordial ooze of HTML and script against a document object model that has more eccentricities than the city of San Francisco?

    In other words, if I can write the following in C#:

    HtmlDocument document = HtmlPage.Document;
    HtmlElement select = document.GetElementByID("mySelect");

    for (int i = 0; i < 10; i++)
    {
        
    HtmlElement option = document.CreateElement("option");
        option.SetAttribute(
    "value", "foo" + i.ToString());
        option.SetAttribute(
    "innerHTML", "foo" + i.ToString());
        select.AppendChild(option);
    }

    ... then why bother doing dynamic HTML using JavaScript? The tools built for C# code are far, far superior to anything written for JavaScript. Even when running a bare Visual Studio with no plugins - I have better refactoring tools, a better debugging experience, and (even in 2008) – better Intellisense when using C#. There are class diagrams, code snippets, and code browsers. Not to mention the support of a base class library that includes many features you won't find all in one place with JavaScript – real meat and potatoes stuff like string formatting and collection classes.

    Certainly paints a bleak picture for JavaScript, doesn't it?

    Well, one reason Silverlight doesn't replace JavaScript is that Silverlight doesn't run everywhere. If you want to reach the widest possible audience, including cell phones with a script interpreter - you'll still be giving JavaScript some love.

    Let's take the best Silverlight scenario, however:

    You are a hard core C# / VB.NET developer. You don't like JavaScript and you never want to work inside a paired set of <script> tags. You are writing an application that you will deliver to users who have the Silverlight 1.1 plugin installed, and all the boilerplate JavaScript code needed to bootstrap the plugin is encapsulated in a control (like the ASP.NET Futures Xaml control).

    Do you ever need to touch JavaScript?

    My answer is ... maybe (I'm hedging my bets because I don't know where Silverlight will be one year from now in terms of features).

    There are some actions you can only perform in JavaScript (throwing up an alert box is one example that comes to mind). Reviewing the earlier code -  is the code isolated from cross-browser quirks? No. Is the API pretty? No - at least not when (in my eyes) compared to JavaScript and not even if we take away all the hard coded strings.

    The real question is: are we gaining anything by writing this code in C# instead of browser's native JavaScript? I have to wonder. Funneling everything through a single type like HtmlElement feels awkward.

    There are two things that could happen to Silverlight that would make me say - "certainly yes".

    1. Silverlight gets a full-fidelity, cross-browser DOM API. Something along the lines of:

      document.getElementByID<HtmlImage>("id").src = "http://www.OdeToCode.com/odetocode.png";

      I doubt this is actually in the game plan for Silverlight, as in a way doesn't serve to further the main purpose of Silverlight, and it's already been done by many other libraries (that are mostly written in JavaScript!).

    2. I get the ability to effortlessly unit-test the browser integration code.

    #2 would be a great feature – (and by unit test I mean tools that are easy to run and integrate with a build engine like NUnit and MbUnit, and not tools that require a browser and some amount of integration pain, like Selenium or JsUnit). The former tools are still important as Silverlight does not yet offer an automation API so the runtime testability story is still weak. For unit-testing I know Jamie has already written a "Test With Silverlight" option to TD.NET, but its still only adhoc testing as I can see. If Microsoft makes it easy to host the runtime outside the brower, and provides some built-in fakes for the DOM objects, we could be off to the races.

  • Ben Carey announces the Big Visible Cruise

    One of the problems with Cruise Control is that while it is constant feedback, it can be pretty easy to ignore. Even with CCTray you can ignore a dot in your task bar, but its a little harder to ignore a huge red band on a monitor in your room. Perhaps even more importantly its embarrassing to have a huge red band displayed on a monitor in the room.

    Big Visible Cruise is a nice little app that makes it easy to display your build status on that spare monitor in your room. (or even nicer would be to grab one of those cheap Vizio LCD TVs and throw it up on the wall)

    -James

  • Steps to Uninstall VS 2008 Beta2 before installing the VS 2008 Final Release

    Several people have asked me for recommendations on the best way to upgrade a system that has VS 2008 Beta2 on it to the final VS 2008 RTM release.  In my blog post announcing the VS 2008 and .NET 3.5 release yesterday I included this bit of guidance:

    People often ask me for suggestions on how best to upgrade from previous betas of Visual Studio 2008.  In general I'd recommend uninstalling the Beta2 bits explicitly.  As part of this you should uninstall Visual Studio 2008 Beta2, .NET Framework Beta2, as well as the Visual Studio Web Authoring Component (these are all separate installs and need to be uninstalled separately).  I then usually recommend rebooting the machine after uninstalling just to make sure everything is clean before you kick off the new install.  You can then install the final release of VS 2008 and .NET 3.5 on the machine.

    Once installed, I usually recommend explicitly running the Tools->Import and Export Settings menu option, choosing the "Reset Settings" option, and then re-pick your preferred profile.  This helps ensure that older settings from the Beta2 release are no longer around (and sometimes seems to help with performance).

    A few people have pointed out to me that there are other smaller setup packages that are optionally installed by Visual Studio 2008 Beta2 that you should also look to uninstall (it isn't always required to-do this - but it is best to always do this to be safe).  A complete list of these additional setup packages (along with uninstall instructions) can be found here

    Below is the complete list of potential Beta2 components to uninstall (as well as the recommended uninstall order of them):

    • Remove "MSDN Library for Visual Studio 2008 Beta"
    • Remove "Microsoft SQL Server Compact Edition 3.5"
    • Remove "Microsoft SQL Server Compact Edition 3.5 Design Tools"
    • Remove "Microsoft SQL Server Compact Edition 3.5 for Devices"
    • Remove "Microsoft Visual Studio Performance Collection Tools"
    • Remove "Windows Mobile 5.0 SDK R2 for Pocket PC"
    • Remove "Windows Mobile 5.0 SDK R2 for Smartphone"
    • Remove "Crystal Reports 2007"
    • Remove "Visual Studio Asset System"
    • Remove "Microsoft Visual Studio Web Authoring Component / Microsoft Web Designer Tools"
    • Remove "Microsoft Visual Studio 2005 Tools for the 2007 Microsoft Office System Runtime"
    • Remove "Microsoft Visual Studio 2005 Tools for the 2007 Microsoft Office System Runtime Language Pack" (non-English editions only)
    • Remove "Microsoft Visual Studio Tools for Office Runtime 3.0"
    • Remove "Microsoft Document Explorer"
    • Remove "Microsoft Document Explorer 2005 Language Pack" (non-English editions only)
    • Remove "Microsoft Device Emulator 3.0"
    • Remove "Microsoft .NET Compact Framework 3.5"
    • Remove "Microsoft .NET Compact Framework 2.0 SP1"
    • Remove ".NET Framework 2.0 SDK"
    • Remove "Microsoft Visual Studio Codename Orcas Remote Debugger"
    • Remove "Microsoft Visual Studio 64bit Prerequisites Beta" (64-bit platforms only)
    • Remove "Microsoft .NET Framework 3.5"

    After you finish uninstalling any and all of the above items, I'd recommend rebooting prior to installing the final VS 2008 and .NET 3.5 release to make sure there is no setup state still on the machine.

    If you run into any problems with either installation or uninstall, please make sure to post in the Visual Studio 2008 Setup and Installation Forum on MSDN.

    Hope this helps,

    Scott

  • The Best Part of Installing Visual Studio 2008

    The best part of installing Visual Studio 2008 ...

    ... is that I don't have to follow up with a four hour install of SP1 for Visual Studio 2005!
  • Visual Studio 2008 and .NET 3.5 Released

    Today we shipped Visual Studio 2008 and .NET 3.5.  You can download the final release using one of the links below:

    • If you are a MSDN subscriber, you can download your copy from the MSDN subscription site.

    • If you are a non-MSDN subscriber, you can download a 90-day free trial edition of Visual Studio 2008 Team Suite here.  A 90-day trial edition of Visual Studio 2008 Professional (which will be a slightly smaller download) will be available next week.  A 90-day free trial edition of Team Foundation Server can also be downloaded here.

    • If you want to use the free Visual Studio 2008 Express editions (which are much smaller and totally free), you can download them here

    • If you want to just install the .NET Framework 3.5 runtime, you can download it here.

    Quick Tour of Some of the New Features

    Visual Studio 2008 and .NET 3.5 contain a ton of new functionality and improvements.  Below are links to blog posts I've done myself as well as links to videos you can watch to learn more about it:

    VS 2008 Multi-Targeting Support

    VS 2008 enables you to build applications that target multiple versions of the .NET Framework.  This means you can use VS 2008 to open, edit and build existing .NET 2.0 and ASP.NET 2.0 applications (including ASP.NET 2.0 applications using ASP.NET AJAX 1.0), and continue to deploy these application on .NET 2.0 machines.  You can learn more about how this works from my blog post here:

    ASP.NET AJAX and JavaScript Support

    .NET 3.5 has ASP.NET AJAX built-in (no separate download required).  In addition to including all of the features in ASP.NET AJAX 1.0, ASP.NET 3.5 also now includes richer support for UpdatePanels integrating with WebParts, ASP.NET AJAX integration with controls like <asp:menu> and <asp:treeview>, WCF support for JSON, and many other AJAX improvements.

    VS 2008 and Visual Web Developer 2008 also now have great support for integrating JavaScript and AJAX into your applications.  You can learn more about this from my blog posts here:

    You can watch some videos that discuss ASP.NET AJAX and Visual Studio 2008 support for it here

    I also highly recommend the excellent ASP.NET AJAX in Action book to learn more about ASP.NET AJAX (both client-side and server-side).

    VS 2008 Web Designer and CSS Support

    VS 2008 and Visual Web Developer 2008 Express includes a significantly improved HTML web designer (the same one that ships with Expression Web).  This delivers support for split-view editing, nested master pages, and great CSS integration.  Below are some articles I've written that discuss this more:

    ASP.NET 3.5 also has a new <asp:ListView> control that provides the ability to perform rich data scenarios with total control over the markup.  It works nicely with the new CSS support in VS 2008.  You can learn more about it from my article here:

    You can watch some videos that discuss the new Visual Studio 2008 web designer features and the new ListView/DataPager controls here

    Language Improvements and LINQ

    The new VB and C# compilers in VS 2008 deliver significant improvements to the languages.  Both add functional programming concepts that enable you to write cleaner, terser, and more expressive code.  These features also enable a new programming model we call LINQ (language integrated query) that makes querying and working with data a first-class programming concept with .NET. 

    Below are some of the articles I've written that explore these new language features using C#:

    Here are a few additional blog posts I've written that show off some of the new VS 2008 code editing support and some cool ways to use these new language features:

    The Visual Basic team has also created some great free videos that cover LINQ.  You can watch them here.

    Data Access Improvements with LINQ to SQL

    LINQ to SQL is a built-in OR/M (object relational mapper) in .NET 3.5.  It enables you to model relational databases using a .NET object model.  You can then query the database using LINQ, as well as update/insert/delete data from it.  LINQ to SQL fully supports transactions, views, and stored procedures.  It also provides an easy way to integrate business logic and validation rules into your data model.  Below are some of the articles I've written that explore how to use it:

    I think you'll find that LINQ and LINQ to SQL makes it much easier to build much cleaner data models, and write much cleaner data code.  I'll be adding more posts to my LINQ to SQL series in the weeks and months ahead (sorry for the delay in finishing them earlier - so much to-do and so little time to-do it all!).

    Scott Stanfield is also working on creating some great LINQ to SQL videos for the www.asp.net site based on my article series above (all videos are in both VB and C#).  You can watch the first 4 videos in this series here.

    Browsing the .NET Framework Library Source using Visual Studio

    As I blogged a few weeks ago, we will be releasing a reference version of the .NET Framework library source code as part of this release.  Visual Studio 2008 has built-in debugger support to automatically step-into and debug this code on demand (VS 2008 can pull down the source for the appropriate .NET Framework library file automatically for you).

    We are deploying the source servers to enable this right now, and will be publishing the steps to turn this feature on in the next few weeks.

    Lots of other improvements

    The list above is only a small set of the improvements coming.  For client development VS 2008 includes WPF designer and project support.  ClickOnce and WPF XBAPs now work with FireFox.  WinForms and WPF projects can also now use the ASP.NET Application Services (Membership, Roles, Profile) for roaming user data. 

    Office development is much richer - including support for integrating with the Office 2007 ribbon, and with Outlook.  Visual Studio Tools for Office support is also now built-into Visual Studio (you no longer need to buy a separate product).

    New WCF and Workflow projects and designers are now included in VS 2008.  Unit testing support is now much faster and included in VS Professional (and no longer just VSTS).  Continuous Integration support is now built-in with TFS.  AJAX web testing (unit and load) is now supported in the VS Test SKU.  And there is much, much more...

    Installation Suggestions

    People often ask me for suggestions on how best to upgrade from previous betas of Visual Studio 2008.  In general I'd recommend uninstalling the Beta2 bits explicitly.  As part of this you should uninstall Visual Studio 2008 Beta2, .NET Framework Beta2, as well as the Visual Studio Web Authoring Component (these are all separate installs and need to be uninstalled separately).  I then usually recommend rebooting the machine after uninstalling just to make sure everything is clean before you kick off the new install.  You can then install the final release of VS 2008 and .NET 3.5 on the machine.

    Once installed, I usually recommend explicitly running the Tools->Import and Export Settings menu option, choosing the "Reset Settings" option, and then re-pick your preferred profile.  This helps ensure that older settings from the Beta2 release are no longer around (and sometimes seems to help with performance).

    Note that VS 2008 runs side-by-side with VS 2005 - so it is totally fine to have both on the same machine (you will not have any problems with them on the same box).

    Silverlight Tools and VS Web Deployment Project Add-Ins

    Two popular add-ins to Visual Studio are not yet available to download for the final VS 2008 release.  These are the Silverlight 1.1 Tools Alpha for Visual Studio and the Web Deployment Project add-in for Visual Studio.  Our hope is to post updates to both of them to work with the final VS 2008 release in the next two weeks.  If you are doing Silverlight 1.1 development using VS 2008 Beta2 you'll want to stick with with VS 2008 Beta2 until this updated Silverlight Tools Add-In is available. 

    Hope this helps,

    Scott

  • Visual Studio 2008 and ASP.NET 3.5 Released

    In case you haven't heard, Microsoft released Visual Studio 2008 and ASP.NET 3.5 today. The Standard, Professional, and Team Systems versions of Visual Studio 2008 are available for download to MSDN Subscribers. For those without an MSDN Subscription, you can download the free Visual Web Developer 2008 or, if you prefer using Notepad or some other IDE, you can download just the .NET Framework version 3.5 runtime.

    Scott Guthrie has a great rundown of the new features in Visual Studio and ASP.NET 3.5. Paul Andrew recently blogged about a downloadable poster of commonly used types and namespaced in .NET 3.5, which is worth checking out. And there are a slew of ASP.NET 3.5-specific videos now up on www.asp.net.

  • Nov 17th Links: ASP.NET, ASP.NET AJAX, ASP.NET MVC, VS 2008, .NET 3.5, IIS7, Silverlight

    Here is the latest in my link-listing series.  Also check out my ASP.NET Tips, Tricks and Tutorials page for links to popular articles I've done myself in the past.

    ASP.NET

    ASP.NET AJAX

    ASP.NET MVC

    Visual Studio 2008 and .NET 3.5

    • .NET 3.5 Reference Poster: Here is an updated .NET Framework Common Namespaces and Types Poster that you can also print out for free.  It details some of the new namespaces and important types in .NET 3.5.

    • Sound Events for Visual Studio: Apparently you you assign sounds to fire when Visual Studio events happen (for example: a build error).  I can't think of a really good use for this other than to annoy co-workers.  Potentially something fun you can enable on their machine when they go to lunch.

    IIS 7.0

    • Running 32-bit and 64-bit ASP.NET versions at the same time in different worker processes: With IIS6 you either had to run all web worker processes in 32-bit mode, or all of them in 64-bit mode.  There was no easy way to mix and match depending on the application (you couldn't have one 32-bit ASP.NET application that needed to use a C++ component on the same machine as another 64-bit ASP.NET application in a separate application pool).  With IIS 7.0 this is now supported and easy to enable.  Rakki Muthukumar from Microsoft support describes how to configure this.

    WPF and Silverlight

    • .NET 3.5 Add-In Model: Jack Gudenkauf is a developer on my team who has driven the design of the new System.AddIn namespace in .NET 3.5.  This namespace makes it easier to build add-in extensibility to your client applications.  Among other things, this enables you to isolate addins and WPF controls across application domain and process boundaries (here is a sample of one).  Watch Jack's Channel9 video to learn more.

    • Data Binding in WPF: A nice MSDN Magazine article from John Papa that describes some of the basics of how WPF's binding model works. Josh Twist also has some good WPF databinding companion articles that complement this here and here.  To learn WPF in more detail, I highly recommend Adam Nathan's excellent WPF Unleashed book (still 5 stars after 45 reviews on Amazon.com).  The next public release of Silverlight 1.1 will support the same powerful databinding model that is in the full WPF, and will make building data aware applications much easier.

    Hope this helps,

    Scott

  • December's Toolbox Column Online

    My Toolbox column in the December 2007 issue of MSDN Magazine is avaiable online. The December issue examines three products:

    • DotNetLiveHelp - a Web- and Desktop-based application that adds 'live chat' functionality to your website, allowing visitors to 'speak' one-on-one with a customer service rep.
    • Instant VB / Instant C# - tools for converting code from VB to C#, or vice-a-versa. Includes tools for coverting entire projects from one language to another and includes an assortment of conversion options.
    • UltraMon - Windows has long supported multiple monitor configurations, but the Windows Desktop has not evolved to handle multi-monitor solutions. UltraMon is a lightweight window management tool designed specifically to enhance the user experience when using multiple monitors.

    This month's issue reviewed Eric and Elisabeth Freeman's Head First Design Patterns. Here is an excerpt from the review:

    At any bookstore, you'll find rows of books on design patterns. Design patterns are general, high-level solutions used by software architects to solve common software design problems. The problem is that most books on design patterns stodgily enumerate key patterns, dryly explaining when and how each is to be used.

    A notable exception is Head First Design Patterns by Eric and Elisabeth Freeman (O'Reilly, 2004), which covers all of the essential design patterns in an entertaining manner. It dispenses with pages of boring text and replaces it with humor-filled lists, questions and answer sections, a variety of diagrams, and heavily annotated code snippets. Gone too are the canonical examples. Instead of using employee or product-related examples, Head First Design Patterns illustrates how and when to use a particular design patterns through silly applications involving pizza, ducks, chocolate, and gumball machines.

    After writing this issue of Toolbox I took a three month hiatus, in part to reduce my commitments during my summer of travel. During this time the column was authored by James Avery. So the January-March 2008 issues will be written by James, and I'm picking the column back up starting with the April 2008 issue.

    As always, if you have any suggestions for products or books to review for the Toolbox column, please send them into toolsmm@microsoft.com.

  • NIH > IH or Castle ActiveRecord Rocks

    The other day I was on a conference call with my client desperately trying to convince them to let me start converting their application over to using MonoRail. The current implementation is XML and XSLT and a custom front controller implementation and hand written data access layer full of stored procedures. I put together a comparison of using MonoRail vs. the existing framework and I estimated it would take 10x less code to implement the same features. During the debate they asked me how I would feel about replacing a ton of code I wrote, and I tried to convince them that I would be ecstatic!

    The first example that came to mind is Castle ActiveRecord. On my last big project we used regular NHibernate. We had a boat load of mapping files, and we wrote what Dave later extracted as NHibernateRepository. We also implemented our own validation engine which Dave later extracted as EVIL. A week ago while I was working up this example I started using Castle ActiveRecord and it does everything we tried to do, only better. There are no mapping files, you get the full benefits of NHibernate, and it encapsulates all of the logic in the model. Then I started using the built in validations and was again impressed, they do a better job then EVIL. As soon as I got through that example application I realized I would never use NHibernateRepository or EVIL again, and I was excited!

    Now, some people would keep using what they wrote. This is called Not Invented Here syndrome. But I would love to use something that is Not Invented Here over something that is Invented Here. (NIH > IH) Why? Well for one Castle ActiveRecord is in my opinion better. Another good reason is that more than one team is working on and using the code. Another good reason is that when I leave the project people will have forums and other developers they can ask for help, etc. etc.

    Due to scheduling I lost the debate with my client, but I plan on vigorously renewing it in two months.

    -James

  • Silverlight 1.1 Alpha – An Appetite for Exceptions

    The current Silverlight 1.1 alpha will eat exceptions. I’m not sure if the final version will behave similarly, but if you are working with the alpha don’t let this behavior surprise you.

    For example, consider the following event handlers that listen to a shape’s mouse events:

    void _box_MouseLeftButtonDown(object sender, MouseEventArgs e)
    {            
        
    throw new NotImplementedException();
    }

    void _box_MouseLeftButtonUp(object sender, MouseEventArgs e)
    {
        _box.Width += 5;
    }

    The left mouse button goes down and … nothing happens. There is no indication of an error.

    When the left mouse button goes up … the shape will grow in size. Silverlight is still running with the attitude of a Broadway director. Despite the setback - the show must go on.

    If you have some mysterious behavior and are not catching exceptions inside event handlers, a good start might be to go into the Visual Studio Exceptions dialog (Debug -> Exceptions) and configure the debugger to break as soon as code throws an exception (the default setting is to only break on a user-unhandled exception). This might help locate the problem.

    There is one area where an unhandled exception will stop the show. Consider the following user control:

    public class ColorfulSlider : Control
    {
        
    public ColorfulSlider()
        {
            
    // code ...
            throw new InvalidOperationException("something went wrong...");
        }
    }

    If we place this faulty user control into the Page.xaml file that the plugin loads – Silverlight will tell us there is a parser error. This tends to make one look inside the .xaml file for malformed XML, when in fact the problem is that Silverlight can’t instantiate the object requested in XAML because of an exception throws from inside the default constructor.

  • ASP.NET MVC Framework (Part 1)

    Two weeks ago I blogged about a new MVC (Model View Controller) framework for ASP.NET that we are going to be supporting as an optional feature soon.  It provides a structured model that enforces a clear separation of concerns within applications, and makes it easier to unit test your code and support a TDD workflow.  It also helps provide more control over the URLs you publish in your applications, and can optionally provide more control over the HTML that is emitted from them.

    Since then I've been answering a lot of questions from people eager to learn more about it.  Given the level of interest I thought it might make sense to put together a few blog posts that describe how to use it in more detail.  This first post is one of several I'll be doing in the weeks ahead.

    A Simple E-Commerce Storefront Application

    I'm going to use a simple e-commerce store application to help illustrate how the ASP.NET MVC Framework works.  For today's post I'll be implementing a product listing/browsing scenario in it.

    Specifically, we are going to build a store-front that enables end-users to browse a list of product categories when they visit the /Products/Categories URL on the site:

    When a user clicks on a product category hyperlink on the above page, they'll navigate to a product category listing URL - /Products/List/CategoryName -  that lists the active products within the specific category:

    When a user clicks an individual product, they'll navigate to a product details URL - /Products/Detail/ProductID - that displays more details about the specific product they selected:

    We'll build all of the above functionality using the new ASP.NET MVC Framework.  This will enable us to maintain a "clean separation of concerns" amongst the different components of the application, and enable us to more easily integrate unit testing and test driven development.

    Creating A New ASP.NET MVC Application

    The ASP.NET MVC Framework includes Visual Studio Project Templates that make it easy to create a new web application with it.  Simply select the File->New Project menu item and choose the "ASP.NET MVC Web Application" template to create a new web application using it.

    By default when you create a new application using this option, Visual Studio will create a new solution for you and add two projects into it.  The first project is a web project where you'll implement your application.  The second is a testing project that you can use to write unit tests against it:

    You can use any unit testing framework (including NUnit, MBUnit, MSTest, XUnit, and others) with the ASP.NET MVC Framework.  VS 2008 Professional now includes built-in testing project support for MSTest (previously in VS 2005 this required a Visual Studio Team System SKU), and our default ASP.NET MVC project template automatically creates one of these projects when you use VS 2008. 

    We'll also be shipping project template downloads for NUnit, MBUnit and other unit test frameworks as well, so if you prefer to use those instead you'll also have an easy one click way to create your application and have a test project immediately ready to use with it.

    Understanding the Folder Structure of a Project

    The default directory structure of an ASP.NET MVC Application has 3 top-level directories:

    • /Controllers
    • /Models
    • /Views

    As you can probably guess, we recommend putting your Controller classes underneath the /Controllers directory, your data model classes underneath your /Models directory, and your view templates underneath your /Views directory. 

    While the ASP.NET MVC framework doesn't force you to always use this structure, the default project templates use this pattern and we recommend it as an easy way to structure your application.  Unless you have a good reason to use an alternative file layout, I'd recommend using this default pattern.

    Mapping URLs to Controller Classes

    In most web frameworks (ASP, PHP, JSP, ASP.NET WebForms, etc), incoming URLs typically map to template files stored on disk.  For example, a "/Products.aspx" or "/Products.php" URL typically has an underlying Products.aspx or Products.php template file on disk that handles processing it.  When a http request for a web application comes into the web server, the web framework runs code specified by the template file on disk, and this code then owns handling the processing of the request.  Often this code uses the HTML markup within the Products.aspx or Products.php file to help with generating the response sent back to the client.

    MVC frameworks typically map URLs to server code in a different way.  Instead of mapping URLs to template files on disk, they instead map URLs directly to classes.  These classes are called "Controllers" and they own processing incoming requests, handling user input and interactions, and executing appropriate application and data logic based on them.  A Controller class will then typically call a separate "View" component that owns generating the actual HTML output for the request.

    The ASP.NET MVC Framework includes a very powerful URL mapping engine that provides a lot of flexibility in how you map URLs to Controller classes.  You can use it to easily setup routing rules that ASP.NET will then use to evaluate incoming URLs and pick a Controller to execute.  You can also then have the routing engine automatically parse out variables that you define within the URL and have ASP.NET automatically pass these to your Controller as parameter arguments.  I'll be covering more advanced scenarios involving the URL routing engine in a future blog post in this series.

    Default ASP.NET MVC URL Routing to Controller Classes

    By default ASP.NET MVC projects have a preconfigured set of URL routing rules that enable you to easily get started on an application without needing to explicitly configure anything.  Instead you can start coding using a default set of name-based URL mapping conventions that are declared within the ASP.NET Application class of the Global.asax file created by the new ASP.NET MVC project template in Visual Studio. 

    The default naming convention is to map the leading URL path of an incoming HTTP request (for example: /Products/) to a class whose name follows the pattern UrlPathController (for example: by default a URL leading with /Products/ would map to a class named ProductsController).

    To build our e-commerce product browsing functionality, we'll add a new "ProductsController" class to our project (you can use the "Add New Item" menu in Visual Studio to easily create a Controller class from a template):

    Our ProductsController class will derive from the System.Web.MVC.Controller base class.  Deriving from this base class isn't required - but it contains some useful helper methods and functionality that we'll want to take advantage of later:

    Once we define this ProductsController class within our project, the ASP.NET MVC framework will by default use it to process all incoming application URLs that start under the "/Products/" URL namespace.  This means it will be automatically called to process the "/Products/Categories", "/Products/List/Beverages", and "/Products/Detail/3" URLs that we are going to want to enable within our store-front application.

    In a future blog post we'll also add a ShoppingCartController (to enable end users to manage their shopping carts) and an AccountController (to enable end users to create new membership accounts on the site and login/logout of it).  Once we add these two new controller classes to our project, URLs that start with /ShoppingCart/ and /Account/ will automatically be routed to them for processing.

    Note: The ASP.NET MVC framework does not require that you always use this naming convention pattern.  The only reason our application uses this by default is because there is a mapping rule that configures this that was automatically added to our ASP.NET Application Class when we created the new ASP.NET MVC Project using Visual Studio.  If you don't like this rule, or want to customize it to use a different URL mapping pattern, just go into the ASP.NET Application Class (in Global.asax) and change it. I'll cover how to-do this in a future blog post (when I'll also show some of the cool scenarios the URL routing engine enables).

    Understanding Controller Action Methods

    Now that we have a created a ProductsController class in our project we can start adding logic to handle the processing of incoming "/Products/" URLs to the application.

    When defining our e-commerce storefront use cases at the beginning of this blog post, I said we were going to implement three scenarios on the site: 1) Browsing all of the Product Categories, 2) Listing Products within a specific Category, and 3) Showing Details about a Specific Product.  We are going to use the following SEO-friendly URLs to handle each of these scenarios:

    URL Format Behavior URL Example
    /Products/Categories Browse all Product Categories /Products/Categories
    /Products/List/Category List Products within a Category /Products/List/Beverages
    /Products/Detail/ProductID Show Details about a Specific Product /Products/Detail/34

    There are a couple of ways we could write code within our ProductsController class to process these three types of incoming URLs.  One way would be to override the "Execute" method on the Controller base class and write our own manual if/else/switching logic to look at the incoming URL being requested and then execute the appropriate logic to process it.

    A much easier approach, though, is to use a built-in feature of the MVC framework that enables us to define "action methods" on our controller, and then have the Controller base class automatically invoke the appropriate action method to execute based on the URL routing rules in use for our application.

    For example, we could add the below three controller action methods to our ProductsController class to handle our three e-commerce URL scenarios above:

    The URL routing rules that are configured by default when a new project is created treat the URL sub-path that follows the controller name as the action name of the request.  So if we receive a URL request of /Products/Categories, the routing rule will treat "Categories" as the name of the action, and the Categories() method will be invoked to process the request.  If we receive a URL request of /Products/Detail/5, the routing rule will treat "Detail" as the name of the action, and the Detail() method will be invoked to process the request, etc. 

    Note: The ASP.NET MVC framework does not require that you always use this action naming convention pattern.   If you want to use a different URL mapping pattern, just go into the ASP.NET Application Class (in Global.asax) and change it.

    Mapping URL Parameters to Controller Action Methods

    There are several ways to access URL parameter values within the action methods of Controller classes.

    The Controller base class exposes a set of Request and Response objects that can be used.  These objects have the exact same API structure as the HttpRequest/HttpResponse objects that you are already familiar with in ASP.NET.  The one important difference is that these objects are now interface based instead of sealed classes (specifically: the MVC framework ships with new System.Web.IHttpRequest and System.Web.IHttpResponse interfaces).  The benefit of having these be interfaces is that it is now easy to mock them - which enables easy unit testing of controller classes.  I'll cover this in more depth in a future blog post. 

    Below is an example of how we could use the Request API to manually retrieve an ID querystring value from within our Detail action method in the ProductsController class:

    The ASP.NET MVC framework also supports automatically mapping incoming URL parameter values as parameter arguments to action methods.  By default, if you have a parameter argument on your action method, the MVC framework will look at the incoming request data to see if there is a corresponding HTTP request value with the same name.  If there is, it will automatically pass it in as a parameter to your action method.

    For example, we could re-write our Detail action method to take advantage of this support and make it cleaner like below:

    In addition to mapping argument values from the querystring/form collection of a request, the ASP.NET MVC framework also allows you to use the MVC URL route mapping infrastructure to embed parameter values within the core URL itself (for example: instead of /Products/Detail?id=3 you could instead use /Products/Detail/3). 

    The default route mapping rule declared when you create a new MVC project is one with the format: "/[controller]/[action]/[id]".  What this means is that if there is any URL sub-path after the controller and action names in the URL, it will by default be treated as a parameter named "id" - and which can be automatically passed into our controller action method as a method argument.

    This means that we can now use our Detail method to also handle taking the ID argument from the URL path (e.g: /Products/Detail/3):

    I can use a similar approach for the List action so that we can pass in the category name as part of the URL (for example: /Products/List/Beverages).  In the interest of making the code more readable, I made one tweak to the routing rules so that instead of having the argument name be called "id" it will be called "category" for this action.

    Below is a version of our ProductsController class that now has full URL routing and parameter mapping support implemented:

    Note above how the List action takes the category parameter as part of the URL, and then an optional page index parameter as a querystring (we'll be implementing server-side paging and using that value to indicate which page of category data to display with the request). 

    Optional parameters in our MVC framework are handled using nullable type arguments on Controller Action methods.  Because the page parameter on our List action is a nullable int (that is what "int?" means syntactically), the MVC framework will either pass in a value if it is present in the URL - or pass in null if not.  Check out my previous post on the ?? null coalescing operator to learn a useful tip/trick on how to work with nullable types that are passed as arguments like this.

    Building our Data Model Objects

    We now have a ProductsController class and three action methods on it ready to process incoming web requests.  Our next step will be to build some classes that will help us work with our database to retrieve the appropriate data needed to handle these web requests.

    In an MVC world "models" are the components of an application that are responsible for maintaining state.  With web applications this state is typically persisted inside a database (for example: we might have a Product object that is used to represent product data from the Products table inside our SQL database).

    The ASP.NET MVC Framework enables you to use any data access pattern or framework you want in order to retrieve and manage your models.  If you want to use ADO.NET DataSets/DataReaders (or abstractions built on top of them) you can.  If you prefer to use an object relational mapper (ORM) like NHibernate, LLBLGen, WilsonORMapper, LINQ to SQL/LINQ to Entities you can absolutely use those as well.

    For our e-commerce sample application I'm going to use the built-in LINQ to SQL ORM shipped in .NET 3.5 and VS 2008.  You can learn m