Yesterday a colleague encountered a strange behavior of Visual Basic 2008 Express Edition in combination with Typed DataSets. When talking about targeting older .NET platforms, the Express Edition of Visual Basic 2008 is not so well suited as the full versions of Visual Basic. In the full versions you can select the target platform when starting a new project (see screenshot), but in the Expression Edition this option is missing.

Fortunately, with some manual work you can overcome this limitation. You can manually remove the references to all .NET 3.5 assemblies. Think about the assemblies System.Core.dll, System.Data.DataSetExtensions.dll and System.Xml.Linq.dll. If you are not sure which version an assembly has, open the properties window of the application. In this window you get an overview of all referenced assemblies, including version information. To open this window choose: Project > ApplicationName Properties > References. An compiled application, with no reference to these or other .NET 3.5 assemblies, will run fine on machines with only the .NET 2.0 Framework installed. So far, so good...
However, Visual Basic 2008 Express has a quirk when working with typed DataSets. When you manually removed the references to System.Core.dll and System.Data.DataSetExtensions.dll, you will be surprised. These references are automatically added when you add a Typed DataSet to your application. And you don't get a warning about this! When you are not aware of this problem and you build your complete application on Typed DataSets, you will be not happy - and that's an understatement - when you try to deploy your killer app on machines with only the .NET 2.0 Framework installed.
The reason why the System.Data.DataSetExtensions.dll (and the related System.Core.dll) are added is that, under .NET 3.5, the DataTables inherits from Global.System.Data.TypedTableBase(Of T) instead of Global.System.Data.DataTable. This change is made to support LINQ. So, a possible solution is to change the derived DataTable class, so it will inherit now from System.Data.DataTable.
Original:
1: Partial Public Class CustomerDataTable
2:
3: Global.System.Data.TypedTableBase(Of CustomerRow)
4:
5: ...
6:
7: End Class
New:
1: Partial Public Class CustomerDataTable
2:
3: Global.System.Data.DataTable
4:
5: ...
6:
7: End Class
An easy change. It is obvious that when you try to target the .NET 2.0 platform you cannot use LINQ, so that would not give a big problem. An other option is to generate the Typed DataSet in Visual Basic 2005, and either copy the code or the assembly to your 2008 project.
Happy coding!