Monday, January 29, 2007

As I've not doubt you've heard, the January CTP of Visual Studio 2007 was released a couple of weeks back ( Initially, I downloaded and installed the side-by-side installer version - I don't much like developing inside a virtual machine, so being able to install it on my main machine alongside 2005 was great (although it is beta software, so I don't recommend you do this unless you're happy to reinstall your machine should it all go awry!).

The main thing I was interested in using is the new ADO.NET Entities features. This CTP doesn't have the designers built in yet (I understand these will come in the next release, probably sometime in Febuary), but I'm happy editing XML by hand so now. As a start point, I got the ADO samples from October ( These opened and built just fine, but fell over almost straight away when I tried running them, with a MissingMethodException being thrown out of the guts of the entity framework. It was trying to access a property called ProviderFactory on a DbConnection object - a quick glance at MSDN (and confirmed with Reflector) showed that, indeed, this property did not exist.

A scan of the forums suggested that other folk did have the samples running, although they were running wthin the virtual environment. Another huge download later, and I span up the samples within a VPC - sure enough, they worked just fine. A quick investigation found that the standard System.Data.dll assembly (the 2.0 version, found in \Windows\Microsoft.Net\Framework\v2.0.50727) had been updated but, for whatever reason, the same update had not been performed when running the Installer version.

I copied the dll across to my dev machine and put it into a new directory, then set the DEVPATH environment variable to point there. Finally, I added the following to the app.config of the sample application:

<developmentmode developerinstallation="true">

This instruts the assembly loader to use the locations specified in DEVPATH during the assembly bind process - and it gets processed first, enabling it to override the contents of the GAC (I didn't want to start replacing files in the GAC at random, since although I don't *mind* reinstalling, I'd rather not if I don't have to!).

Bingo! The samples now work on my main machine (running Vista). I don't know if this is an ommission in the current installer, or if some error occurred (silently!) during the installation itself. However, the above seems to resolve it for now.