Bugs item #1082302, was opened at 2004-12-09 09:32 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=474851&aid=1082302&group_id=54790
Category: Tasks Group: 0.85 Status: Open Resolution: None Priority: 5 Submitted By: Hani Atassi (haniatassi) Assigned to: Nobody/Anonymous (nobody) Summary: Vb6task ignors references when parsing the project. Initial Comment: I noticed this problem when my project is not compiled, even though there was a reference file that has changed. Vb6task didn’t detect any changes that require compilation but there was a change. I tracked the problem down to the function ParseProjectFile. One TLB file couldn’t be found and the API function QueryPathOfRegTypeLib failed to find it. The comment afterward in the code says “Typelib wasn't found - vb6 will barf when the compile happens, but we won't worry about it.” This is not totally correct because vb6 compiles my project. So what’s the problem!! After some investigation with VB, I found the following behavior: 1. Once you add a reference in VB, the version won’t change in the project file even if you update the type library to a newer version. The version will change only if you unselect the old reference and select the new one. So, consider you originally have your project set to use ver 1.0 of TestObj.tlb. Later on, you created ver 2.0 and unregistered ver 1.0. If you open the project, you will notice that you are using by default the newer version even that the project file says that you are using ver 1.0. 2. The minor version sometimes is a hex number, even though this is not indicated by MSDN documentation. Some of the references that I am using has a version similar to 1.a, 1.b, 1.14, … These versions can actually be treated as 1.10, 1.11, 1.20… You can figure this easily by calling QueryPathOfRegTypeLib with the following: * major: 1 minor: 10 The function will return the TLB for 1.a * major: 1 minor: 14 The function will return the TLB for 1.14 (here 14 is treated as decimal) * major: 1 minor: 20 The function will return the TLB for 1.14 (because 14 in hex equals 20) The regular expression (referenceRegEx) actually ignores the reference file if it has a hex minor version. Example of this would be (Common Language Runtime Library v1.1.4322 has a TLB version 1.a) 3. VB has a weird behavior in choosing the TLB library to compile against. Even with this behavior that I will describe next, Vb6task should copy the same behavior in checking for reference out-of-date: VB6 uses a special algorithm to search for the typelib file. It doesn't rely on the API function QueryPathOfRegTypeLib, because VB could use a newer version of the TLB. The algorithm used by VB is not perfect and has some flaws, that you could get a newer version even if your requested version is installed. This is because the algorithm iterates the registry beneath the Guid - entry by entry - from the beginning and returns the first TLB version that is higher or equal to the requested version. So, if you have the following versions installed for a specific tlb Guid under the registery key HKEY_CLASSES_ROOT\TypeLib\{Guid}: 2.0 5.0 If your project requesting version 1.0, VB will use tlb ver 2.0. If your project requesting version 4.0, VB will use tlb ver 5.0. If your project requesting version 8.0, VB will fail and will say the object is MISSING. Now consider the following situation where the versions are like the following: 5.0 2.0 If your project requesting version 1.0, VB will use tlb ver 5.0. If your project requesting version 2.0, VB will use tlb ver 5.0. (Notice that 2.0 exist but it’s been recorded after 5.0 somehow by installing an older version after the newer version) If your project requesting version 8.0, VB will fail and will say the object is MISSING. You can check out this behavior by playing with the registry and VB project file. I came up with the following pseudo code that describes how VB searches for the TLB to use: 1. open the key HKEY_CLASSES_ROOT\TypeLib\{Guid} 2. If the key exists: 3. Foreach version under the key that has the requested culture entry 4. If the version higher or equal to the requested version: 5. Get the TLB filename and returns it Hope what I’ve just said makes since. I patched the file Vb6task.cs, with the previous problems. I don’t think that this change would break anything. Take a look at it. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=474851&aid=1082302&group_id=54790 ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/ _______________________________________________ NAntContrib-Developer mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nantcontrib-developer