After an hour or two of trying to figure out why some resx files in a <vbc> task were not being compiled with the correct .mresource name, while others were, I noticed the following:
CompilerBase makes a call to PerformSearchForResearchLinkage and attempts to locate either the namespace line or the class line in a particular code file that is linked to a resource file (this all happens in lines 650 - 680 in the latest nightly). The regular expressions for vb files as defined in VbcTask are:
private static Regex _classNameRegex = new Regex(@"^((?<comment>/\*.*?(\*/|$))|[\s\.]+|Class\s+(?<class>\w+)|(?<keyword>\w+))*");
private static Regex _namespaceRegex = new Regex(@"^((?<comment>/\*.*?(\*/|$))|[\s\.]+|Namespace\s+(?<namespace>(\w+(\.\w+)*)+)|(?<keyword>\w+))*");
As far as I can tell (since I'm not overly familiar with regex), these are case sensitive.
Those VB files in my solution that are coded as follows:
Imports System
Namespace foo.bar.goober
Public Class widget
End Class
End Namespace
These are built into the manifest as:
.mresource public foo.bar.goober.widget.resource
{
}
However, if I had something like:
Imports System
namespace foo.bar.goober
public class widget
end class
end namespace
This was being built into the manifest as:
.mresource foo.bar.widget.resource
{
}
Where the incorrect line is .mresource <prefix>.<classname>.resource, but should be <namespace>.<classname>.resource. I can correct this by capitalizing Namespace.
The whole point of this discussion is...since VB is case insensitive on reserved words, shouldn't the regular expressions for class name (defined in _classNameRegex) and namespace (defined in _namespaceRegex) be case insensitive as well?
FWIW this can be reproduced by using the following setup:
* A VB Application project with no root namespace.
* A pretty mundane <vbc> task:
<vbc target="winexe" output="foo.exe" imports="System" rootnamespace="" main="MainThread">
<sources basedir="foo">
<includes name="**/*.vb">
</sources>
<resources basedir="foo" dynamicprefix="true" prefix="foo.bar">
<includes name="**/*.resx">
</resources>
etc...
</vbc>
I suspect this issue may have arisen on my machine, and not others due to the fact that I turned off the default VB "beautification", since the closer I can get VB to look and read like C/C++/C#/java, the happier I am. Consequently, most of the casing of reserved words is camel cased (i.e. public instead of Public).
__
Kevin Brill
Business Systems Development
[EMAIL PROTECTED]
How Careers End:
* Office Clerks are defiled
* Electricians are refused
* Piano tuners are unstrung
* Orchestra leaders are disbanded
* Engineers are reverse engineered
