ADO.NET Data Services and LINQ to SQL – Errors Generating Proxy Code with DataSvcUtil.exe

Something that I came across today – if you’re trying to surface a LINQ to SQL data source via the latest build of ADO.NET Data Services and you’re running datasvcutil.exe on the metadata of the service then you might find yourself with a whole bunch of errors.

Here’s a sample of what I was getting this morning;

error 7001: Schema specified is not valid. Errors:
$metadata(0,0) : error 0005: The ‘Namespace’ attribute is invalid – The value ”  is invalid according to its datatype ‘
edm:TNamespaceName’ – The Pattern constraint failed.

For me, I resolved this by just making sure that I revisited my DBML diagram for LINQ to SQL in Visual Studio and set the “Entity Namespace” property for code generation.

That is, click on the white-space of the diagram;


to make sure that you have the diagram rather than a particular entity set selected. Then hit F4 for the properties;


and give yourself a namespace and all the errors seem to go away reasonably quickly 🙂