The first message of this bug will be “Can’t copy XXX.tlb to __history\XXX.~1~” (or something like that). Okay, no problem simply switching off backup copies (Preferences – Editor) and you are done. Not really, since now Delphi will throw a new error “Can’t rename XXX.$$$ to XXX.tlb”. Checking with Process Monitor reveals that Delphi itself (BDS.exe) is locking the TLB file. Nice, isn’t it?
Looking a little bit around and it seems this bug only appear when Delphi is installed on Vista AND the type library you are editing has a reference to OLE Automation v1.0 (stdole32.tlb). If the type library has a reference to OLE Automation v2.0 (stdole2.tlb) this bug won’t show up. The solution I found was to open the project on Windows XP, exchange the reference and reopen the project on Vista. But I don’t have an XP box anymore so the solution was a little bit strange:
Exchange the reference of OLE Automation v1.0 to v2.0 inside the Type Library Editor (Tab “Uses”), then try to compile the project. This will fail because of the “Can’t rename…” error. Anyway, copy the [FILENAME].$$$ from the project folder to a new folder while Delphi is running. Once this is done, close BDS (no, you can’t save the project because of the error). Now delete the old TLB file and rename [FILENAME].$$$ to [FILENAME].TLB and copy it to the project folder.
Start Delphi again, open the project and check if the “Uses” tab now says you are using OLE Automation Version 2.0. If so, everything should be back to normal again.