I realized that folder containing a '-' character which are namespace provider do get a different namespace than expected.
e.g. I observe that the embedded resource:
AssemblyName/lib/font/source-sans-pro/source-sans-pro.css
will have the following namespace at the end:
AssemblyName.lib.font.source_sans_pro.source-sans-pro.css
So for folders, but not for files (why?), the namespace changes such that '-' is replaced with the '_' underscore character.
Unfortunately I could not find any official references describing this behavior. Can anyone provide some references about this behavior? Why does the folder namespace change? And why not the namespace of the file?
Hyphens aren't allowed in identifiers, and namespaces are identifiers. The reason is pretty simple, if you think about it - x-y
is the binary -
operator with operands x
and y
. Trying to make it also a valid identifier would be pretty terrible.
The full description of permitted identifiers is in the C# 5 spec, section 2.4.2. Of course, your embedded resource ends up being more related to the CLI spec than the C# spec, but that has similar rules - defined (in ECMA-335) to follow the rules of Annex 7 of Technical Report 15 of the Unicode 3.0 Standard.
See more on this question at Stackoverflow