visual studio – Workaround to set default value for a Guid column in a strongly typed DataSet


Steps to reproduce issue:
In Visual Studio, in a new .Net framework app, add a new strongly typed DataSet (xsd). Add a new DataTable. Add a non nullable Guid column, and for the DefaultValue, type in: 00000000-0000-0000-0000-000000000000 .

When the Custom Tool is run, you see an error in Visual Studio like:

Custom tool error: Failed to generate code. Object of type ‘System.Guid’ cannot be converted to type ‘System.String’. Object of type ‘System.Guid’ cannot be converted to type ‘System.String’.

Are there any workarounds? One could possibly set the default column value manually in the DataSet’s Designer.cs file, but hoping to prevent this as your manual change will get overwritten when the Designer.cs file is regenerated.

Leave a Reply

Your email address will not be published. Required fields are marked *