What does MSBuild escape in embedded resorce names

147 views Asked by At

I've noticed MSBuild escapes folders that start with a number when it's generating the resource name

e.g.
...\2012.01.01\site.css becomes ..._2012._01._01.site.css in the resource name

Is there any documentation on the rules MSBuild uses to determine the resource name?

Is there a method/API call I can make to escape a name?

It's breaking my VirtualPathProvider because the key in my dictionary doesn't match the path upon retrieval.

Obviously there is a hacky fix for this but I'd prefer something more robust.

The code in question is 3rd Party so I'd prefer not to use the LogicalName approach detailed here LogicalName Approach

1

There are 1 answers

0
Michael Gunter On

Resource names are namespaced just like .NET classes. When site.css is turned into a resource, it naturally becomes ...2012.01.01.site.css but that's not a valid resource name because namespace names cannot start with digits. So the compiler sticks an underscore before each namespace component. You'd probably see the same thing on the file name if your file was named something like 100site.css.

The C# language specification is a good resource for identifier rules, but I don't think you'll find individual tool behaviors to be very well-documented on the web.