No Clean Feed - Stop Internet Censorship in Australia

HOWTO: Create a Mono-friendly strongly typed DataSet

Most .NET developers know they can use the MSDataSetGenerator tool in Visual Studio to automagically generate strongly typed DataSets from XSD schema files. I make use of this functionality on a regular basis, and naively assumed the generated code would build under Mono.

No such luck, unfortunately. There were two main problems; firstly, a custom attribute related to Visual Studio on the DataSet itself:

[System.ComponentModel.Design.HelpKeywordAttribute("vs.data.DataSet")]

Then, there was an issue whereby one of the generated properties had a more restrictive access modifier than the type of which it was an instance (if I recall correctly - I don't have the error to hand).

The solution is to disable the custom tool in Visual Studio, and generate the strongly typed DataSet using the xsd.exe tool that comes with Mono (all the MSDataSetGenerator tool does is invoke the Microsoft xsd.exe tool):

xsd.exe Passwords.xsd /d /namespace:NoX

... and Bob's your uncle, you have a strongly typed DataSet in Passwords.cs. Just add the .cs file to your project in both Visual Studio and MonoDevelop, and away you go. Just remember though, you'll have to manually regenerate Passwords.cs if you ever change the schema file.