Unable to generate a temporary class (result=1). error CS0030: Cannot convert type 'Type[]' to 'Type'?

Solution 1:

You need to change the type of a member variable in the serialized class. For example if its raising an error like:

Unable to generate a temporary class (result=1). error CS0030: Cannot convert type 'Data[]' to 'Data'.

I ran a search on the Data type name in the generated file, and I found this:

[System.Xml.Serialization.XmlArrayItemAttribute("Data", typeof(Data), IsNullable=false)]
public Data[][] Row

Replace Data[][] with Data[] - Change the type of Data from a 2D array to a 1D array. It would solve your problem. :)

Solution 2:

Had the same problem, but Xsd2Code didn't integrate with VS2012. So instead I went to my xsd.exe generated .cs file and did:

Find [][] Replace []

which worked.