1

A legacy application displays the version numbers of all of its components, which are supposed to be DLLs. We are tricking the application for various reasons by putting TLBs in the folder that gets queried. However, when it lists the version information, it comes up as "Unknown" because TLB files do not have a File Version property.

When we generate the TLB with regasm filename.dll /tlb:filename.tlb, is there a way to get regasm to generate a TLB such that it has a file version? I have been unable to find any information about this online. I assume that it is just not possible and therefore we'll have to come up with a workaround...

Dave
  • 14,618
  • 13
  • 91
  • 145
  • TBL files do support file version, so you could add the file version post regasm using a tool, something like: https://stackoverflow.com/questions/284258/how-do-i-set-the-version-information-for-an-existing-exe-dll – Simon Mourier Oct 20 '17 at 17:38
  • 1
    It is not so obvious that you are using the tlb files correctly. They do not contain any code, just declarations. They are the exact equivalent of metadata in a C# assembly. And are often likewise embedded in the executable file that implements the library. There are a few corner cases where you need to deploy them as well, but they are not common. They do have a version number, just major.minor, visible in the Project > Add Reference > COM tab. Inspecting it is possible, pinvoke LoadTypeLib to get ITypeLib, call its GetLibAttr() method. – Hans Passant Oct 20 '17 at 18:54

1 Answers1

0

Check out the TypeLibVersion assembly attribute.

acelent
  • 7,965
  • 21
  • 39