Monday, February 1, 2016

Specify a valid .NET type name for this root node.The current .NET type of this root node is invalid

In current project I have to work on papiNet schema, an opensource schema used for paper industry, this schemas for it can be downloaded here . 

To start with, I created a project in visual studio and added PurchaseOrderV2R40 schema to it (which I downloaded from link mentioned above). To make sure all is ok with schema, I build the project and was encountered with errors for few nodes

"Specify a valid .NET type name for this root node.The current .NET type of this root node is invalid(it is reserved BizTalk Keyword or is an invalid C# identifier)"

as can be seen in below image.

Why it happened:

The errors say that few mentioned nodes does not have valid .NET type name - it refers to RootNode TypeName property. As can be seen in image(marked in yellow), there is hyphen(-) used in RootNode TypeName and that is not allowed.

What to do:

As hypen is not allowed, I removed it  from all nodes having it and build the project -- all the errors were gone.

Note: I am not sure what implication will it have as the project progresses, I think there won't be any problem but if any then will update

1 comment:

  1. I had a similar issue with the Amazon marketplace schemas (the order fulfillment and product catalog schemas). Instead of an invalid character however, the issue appeared to be that the compiler didn't like the typename being the same as the root node name (that and there were no namespaces in the .xsd files).

    Ultimately I didn't encounter any issues after I changed the typenames.

    (still on BizTalk Server 2010)