Windows Script Host cannot reference type library with version number in hexadecimal notation
See the question and my original answer on StackOverflowFor the WSH reference node to work it must be capable of loading a COM Automation Type library (TLB) from the reference
node.
There are two ways for that:
- the COM server embeds a TYPELIB Win32 resource
- the CLSID registry key associated with the COM server indicates what is the TLB Id and its version
It works w/o effort with COM servers such as ADODB.Recordset because they are in case 1).
In the .NET case, the .NET .dll doesn't embed any TLB information so you must indicate it. So to fix it you must:
- Create a
HKEY_CLASSES_ROOT\CLSID\{yourclsid}\TypeLib
with a default value equal to your TYPELIB identifier formmated as {guid} - Create a
HKEY_CLASSES_ROOT\CLSID\{yourclsid}\Version
with a default value equal to your version, ie: "1.10"
Why you don't need that when minor version is < 10 is probably a bug in scrobj.dll (which implements WSH parsing). I suspect the code 1) uses default 1.something value when nothing is specified and 2) is broken when the major or minor versions are hexa. Here is a dump of the function that does it, it uses strtoul with a 10 radix/base instead of 16: