An error never comes alone … When an error appears, it always appears two or three, and I still have thousands to published, but this one but this one made me crazy for a few minutes: The type or namespace name ‘SerializableAttributeAttribute’ does not exist in the namespace!
Yes, you read it right, while I was trying to compile a RosettaNet schemas projects, in this particular case a PIP3B2 Advance Shipment Notification I got thousands of errors, 3054 to be exact saying:
Error 1 The type or namespace name ‘SerializableAttributeAttribute’ does not exist in the namespace
RosettaNet.Common.Schemas._3B2.System’ (are you missing an assembly reference?)
C:\TFS\…\RosettaNet.Common.Schemas.3B2\Domain\Logistics\CodeList\RN_FreightPaymentTerms_01_03.xsd.cs 9 13 RosettaNet.Common.Schemas.3B2 …
Error 3054 The type or namespace name ‘NonSerializedAttribute’ does not exist in the namespace ‘RosettaNet.Common.Schemas._3B2.System’ (are you missing an assembly reference?) C:\TFS\…\ RosettaNet.Common.Schemas.3B2\Domain\Procurement\INT_Procurement_02_07_01_09.xsd.cs 5072 21 RosettaNet.Common.Schemas.3B2
… and several other schemas as you may see in the picture below.
But do not be fooled into thinking this is a problem related exclusively to RosettaNet, it is not, and it can happen with any “normal” or any kind of schemas.
There are certain keywords, type names, and identifier names that you should use because they are internally used by BizTalk and it way enter in conflict and sometimes originate problems and errors, keywords like activate, atomic, body, task, compensate, method and several ones, you can see the full list here XLANG-s Reserved Words. But there are other keywords that depending on the artifact, may give you problems like:
- BTS (associated with Microsoft.BizTalk.GlobalPropertySchemas assembly)
- “-“ in RootNode Typename inside schemas
If you use the keyword “System” inside a schema namespace like:
You will not be able to compile your schema project.
The problem, if you download from the GS1 RosettaNet Standards certain PIP’s they will have the following structure:
And as you see, there is a folder “System” that inside have several schemas and normally the schema namespace is composed by the project name or (assembly name) and the path to the schema, for example in this case:
- Or RosettaNet.Common.Schemas._3B2.System
And this is causing all of these problems because in this case, “System” is a reserved keyword that shouldn’t be used.
The difficult part of this error was finding the cause of the problem. Once you know what is causing the problem the solution is quite simple. You just need to:
- Change the “Namespace” property on all the schemas the word “System” to another name, for example, “_System” (to maintain the consistency but it can be other word/value)
In my case, I hade the change the “Namespace” property of the schemas in the “System” folder
You can now rebuild your schema solution and this error should go away.