Enterprise Library for .NET 2.0 Finally Arrives!

Updated 1/20/2006

I hope you’re not still using the Microsoft Data Access Block and sibling Blocks in your code.  If you are, I hope you have a good excuse!  Microsoft released Enterprise Library for .NET 1.1 about a year ago to replace the old Blocks.  It was co-developed by Microsoft and Avanade, and Avanade still carries on a proprietary enhanced version called ACA.NET.  The former Blocks that were incorporated into Enterprise Library gained a more unified programming and extensibility model, improved documentation and samples and an extensible GUI configuration tool.  We used Enterprise Library throughout most of 2005 on a large WinForms app, and it worked great.  I recommend it to every .NET development team.

Since then, I’ve moved on to Visual Studio 2005 like many of you, and we’ve all been (patiently?) waiting for Microsoft patterns & practices to rework Enterprise Library for .NET 2.0.  A couple deadlines passed with no code, but it’s finally here.  You really owe it to yourself and your dev team to check out the excellent work being provided by the patterns & practices team.

Share and Synchronize Files for Free, Courtesy of Microsoft

With Microsoft buying up companies and not always merging them into the Microsoft brand, it’s easy to miss some great Microsoft services.  In November 2005, Microsoft purchased FolderShare, a service for synchronizing and sharing files across multiple devices.  FolderShare was a subscription service, but no more — Microsoft made it free.

FolderShare seems like a terrific service.  No more ZIPping and emailing large files!  No more burning CDs and then tossing them!  Forgot your USB key?  No problem.  FolderShare lets you share files up to 2 GB in size, and at least for now, there are no limits on quantity or size of files transferred.  Hard to believe it’s really free.  Maybe Microsoft will eventually make it a Windows Live subscription service.  Until then, enjoy!

SharePoint Portal Server 2003 SP2, or How Not to Design a Service Pack

Microsoft released SharePoint Portal Server 2003 Service Pack 2 (SP2) in October 2005, following the weeks-earlier release of Windows SharePoint Services Service Pack 2 (SP2).  I was hoping to get .NET Framework 2.0 installed on our SPS Web server for other purposes, so I was hoping that Microsoft addressed the .NET Framework 2.0 incompatibilities with SP2.  It looked promising because WSS SP2 specifically mentioned ASP.NET 2.0 support.

After reviewing the release notes and backing up the portals and sites with the SharePoint Portal Server Data Backup and Restore tool, I installed WSS SP2.  It installed cleanly with no issues, so I was off to a good start.

Next was the SPS SP2 install.  Microsoft’s Office team has produced a lot of complicated service packs in the past.  They should know how to do it right.  Clearly this is a different team, because the folks that signed off on QA and user experience for this one deserve to be fired.  Running this service pack produces the familiar Windows Installer progress dialog, which runs for a while and then disappears.  There is no confirmation when it finishes — no matter whether it succeeds, fails, or falls somewhere in between.

It turns out there are two phases to the SPS 2003 SP2 installer.  The first phase upgrades SharePoint Portal Server’s program installation with SP2 files.  The second phase goes through each of your portal sites and attempts a database upgrade on each one.  This is where my four hour struggle began.

The only way you can tell if your SP2 install succeeded, or to what degree, is to read the event log.  You MUST do this.  Search the Application event log for an event that contains text similar to this:

Attempted to apply update to SharePoint Portal Server 2003 portal sites.
Number of portal sites: value
Number of portal sites attempted: value
Number of portal sites successfully updated: value
Not run: value

In my case, this is what I found:

Attempted to apply update to SharePoint Portal Server 2003 portal sites.
Number of portal sites: 1
Number of portal sites attempted: 1
Number of portal sites successfully updated: 0
Not run: 0
Consult the ReadMe file included with this patch, or *_spsadmin.log for more details.

Once again, looking for this “successfully updated” mismatch with “attempted” in the Event Log is the only way you will know the result of your SP2 install.

Next stop was \Program Files\SharePoint Portal Server\Logs, where I found logs that contained the same text and some unhelpful .NET exceptions.  In order to make SPS retry the database upgrade, you have to edit the registry.  [WHAT?!?  Yes, it’s true.]  Here’s a KB article that describes the registry modification.  I probably made this change 30 times over the next 3-4 hours.

I eventually found an obscure WSS/SPS KB article or two (unrelated to SP2) while grasping at straws, ended up restoring my sites and portal from the backup, and eventually managed to get it to upgrade the database successfully.  It was not a pleasant experience.  After all that work, it looks like SP2 may have added or modified one app.exe.config file for Framework 2.0 compatibility.  It’s possible that there were other changes, but SPS portals remain incompatible with ASP.NET 2.0.  Do not run your portal sites under ASP.NET 2.0 (I tried for a while).

Please do not skip your backups before these upgrades, and be ready for possible troubles.

ASP.NET 2.0 Master Pages Design Templates Set

For the graphic-design challenged among us, Microsoft has released a set of Design Starter Kits and XHTML 1.1 Strict-compliant HTML templates for ASP.NET 2.0.  These are not coding best practices kits — they demonstrate Web UI standards-compliance and best practices using CSS and XHTML.  Many of them look really sharp, and most of us developers need the help using CSS and XHTML correctly to create great looking pages.

.NET Framework 1.1 and 2.0 Side-by-Side (SxS)

December 18, 2006 Update: You may find my post on .NET 3.0 compatibility useful.

As a part-time systems engineer, I was very concerned about possible negative effects of installing the .NET Framework 2.0 side-by-side with 1.1 on our Windows Server 2003 boxes that run things like SharePoint Portal Server, Windows SharePoint Services and Exchange 2003.  I’ve searched and searched, and it seems like Microsoft is making little effort to document .NET Framework 2.0 compatibility with their server products.

It helps to understand how different types of executable code load the Framework.  Unmanaged applications that host the Common Language Runtime (CLR), that is, non-.NET applications that manually load the CLR in order to run .NET code, always load the newest installed version of the .NET Framework by default.  This behavior directly impacts SharePoint Portal Server, as one example, in a negative way.  Some unmanaged executables in SPS host the CLR, so as soon as you install 2.0 and restart the SPS apps, they will load 2.0, not 1.1 as they were designed and tested against.  BAD!

Fortunately, managed applications behave better.  A managed application that was built against 1.1 will continue to load 1.1, as long as 1.1 is installed.  (On Windows Server 2003 you don’t have a choice, but on other OS’s you can uninstall 1.1.)  A managed application that was built against 2.0 will only load 2.0.  If you uninstall Framework 1.1, your 1.1 managed app will now load 2.0 instead.

Confused?  When Microsoft doesn’t document which unmanaged apps host the CLR, the bottom line is that you need to be careful installing 2.0.

If you identify an unmanaged app that hosts the 1.1 CLR and you want to install Framework 2.0, there is a way to force the unmanaged app to load the old Framework:

  1. Locate the unmanaged EXE, and in the same directory, create (or edit) a text file called <unmanagedexename>.exe.config.  Ex: myapp.exe needs myapp.exe.config.
  2. Paste this text into the new text file (or merge it into the existing file; you may already have <configuration> and/or <startup> elements):
    <?xml version =”1.0″?>
    <configuration>
      <startup>
        <supportedRuntime version=”v1.1.4322″ /> 
      </startup>
    </configuration>
  3. Save the config file and start or restart the EXE or service

Installing the 2.0 Framework without adding or updating the config files will affect SharePoint Portal Server and BizTalk Server 2004.  BizTalk Server 2006 natively runs on, and requires, .NET Framework 2.0, and runs just fine with .NET Framework 3.0 as well.

To safely install 2.0 on your BizTalk 2004 server:

  • Add (or update) a config file for each EXE in your BizTalk 2004 installation folder
  • Reboot or restart all BizTalk services
  • Review Microsoft’s KB
  • After installing Framework 2.0, ensure that all BizTalk Web services remain configured to run under ASP.NET 1.1.

To safely install 2.0 on your SPS servers:

  • Add (or update) a config file for each EXE in your SPS installation folder
  • I recommend installing WSS 2.0 SP2, which explicitly supports ASP.NET 2.0, and then SPS 2003 SP2.  If you are not ready to upgrade, you can still add the config files and safely install 2.0 on SP1 or earlier.
  • After installing Framework 2.0, ensure that all SPS portal Web sites remain configured to run under ASP.NET 1.1.  SPS SP2 does not support ASP.NET 2.0, even though WSS does.

To safely install 2.0 on your Exchange 2003 servers:

  • Exchange Server 2003 doesn’t appear to host the CLR, so it should be safe to install 2.0 on Exchange front-end or back-end servers.  I installed it on our front-end server with no issues.
  • After installing Framework 2.0, ensure that the OWA Web site remains configured to run under ASP.NET 1.1 (IIS Admin, site properties, ASP.NET tab).

Installing .NET Framework 2.0 installs ASP.NET 2.0.  By default, this will not change existing IIS Web sites to 2.0 — they will remain set to 1.1/1.0.  You can control this in IIS Admin in the site properties under the new ASP.NET tab.  Do not try to mix ASP.NET 1.1 and 2.0 apps within a single AppPool on Windows Server 2003.  Create separate AppPools for each version.

Office 2003 is unmanaged but does host the CLR, so it may also be affected by installing Framework 2.0.  There are known issues with Office 2003 when loading add-ins, smart tags or smart documents created with .NET Framework 2.0.  There is also a related VS2005 update for Visual Studio 2005 developers.

Visual Studio .NET 2003 developers may experience trouble in certain cases after installing Framework 2.0.  One such issue is fixed in .NET Framework 1.1 SP2.

The Framework documentation briefly, and poorly, discusses the side-by-side issue here.

I would appreciate comments on this post!  Is it helpful?  What information can I expand on?  Are there other issues that you are concerned about or have experienced?

Background Compilation in Visual Studio 2002, 2003 and 2005

Background compilation is a feature of the Visual Studio IDE.  It includes a special version of the language-specific source code compiler that runs continuously on a background worker thread.  Each time you make a change in the code editor, the background compiler wakes up and attempts to compile the code.  This is the feature that’s responsible for the squiggly marks under code in the editor and errors in the Task List while you’re writing code.

Microsoft first introduced background compilation to the Visual Studio.NET 2002 IDE for VB.NET projects.  The other languages did not ship with background compilers.  Most of the time background compilation is a great productivity enhancer, alerting you to your errors immediately.  When you switch back and forth between VB.NET and C#, for instance, you really miss this feature.

Unfortunately, background compilation tends to be the most unstable portion of the IDE.  Have you ever been working in a VB.NET project when the IDE suddenly crashes with “unexpected compiler error?”  Have you had the compiler suddenly begin informing you that variable xyz is not defined, when you’re looking at the declaration on screen?  You’ll find that when you restart the IDE, these errors magically disappear.  These issues are all due to bugs in the background compiler.

The most amazing thing about these bugs is that Microsoft virtually denies that they exist.  At least 80% of the VB.NET projects I’ve worked on have experienced these problems once the code base grows beyond trivial size.  While I was working for Microsoft, I found records of the background compiler bugs in their internal bug tracking database.  There is even a hotfix for Visual Studio.NET 2002 and 2003 that addresses some of them.  However, this hotfix was never made publicly available.  We eventually obtained it from Microsoft PSS, and I’ve carried it with me from client to client ever since.  It doesn’t fix all the bugs, but it’s better.  It amazes me that there was never a service pack for VS.NET 2003.  I’ve heard that one may be coming — now that Visual Studio 2005 is released and people are moving away from 2003.

With the introduction of Visual Studio 2005, both VB.NET and C# include background compilation.  And guess what?  Reports are already coming in [more] that the C# background compiler crashes in certain situations, some involving the use of generics.  Thankfully they also added AutoSave to the 2005 IDE.  The unofficial timeline for Visual Studio 2005 SP1 is sometime in mid-2006.

In short, background compilation is a great productivity enhancer, but is not without its problems.

VS 2005 Refactoring Support for Visual Basic

IDE support for refactoring is one of the key additions to C# in Visual Studio 2005.  Unfortunately, refactoring did not make it into the IDE for Visual Basic.  In case you missed the announcement, in the end, Microsoft provided a solution for Visual Basic by partnering with a third-party company to provide their add-in, Refactor!, for free.

VB 2005 developers, download Refactor! here!

Visual Studio 2005 Licensing – A Sad State of Affairs

Microsoft may be an awesome technology company, but they have often managed to screw up licensing and major marketing efforts.  Remember when they thought that every product name should have .NET attached to it?  Remember ActiveX?  How about Licensing 6 and Software Assurance?

Astonishingly, they have completely botched the Visual Studio 2005 licensing model.  I don’t even know where to begin.

First off, Microsoft partners, accustomed to getting almost any software they want, are the first casualty.  Certified Partners receive only VS 2005 Professional, sans unit testing, static code analysis, deployment designer and more.  Even a Gold Certified Partner only gets VS 2005 for Software Developers.  Neither one gets Team Suite, let alone Team System.  OK, they get a TRIAL version of Team Suite, for what that’s worth.

The incredibly confusing product names are the second part of the mess.  Express, Professional, for Software Developers, for Architects, for Testers, Team Suite, Team System, each and every one a different SKU with different features included.  Who signed off on this disaster?  No one can understand what’s what without elaborate charts and pictures.

My current client was excited to move to VS 2005, but the managers certainly didn’t have time to negotiate this licensing maze.  Fortunately, I discovered that they were about to order the wrong product SKUs and corrected their confusion on what was what in the product line.  Imagine this scenario repeating itself across the globe.

Shame on Microsoft’s marketing department for this, the biggest Visual Studio launch in the history of Microsoft!

%d bloggers like this: