I want my inno setup to loop through dlls (both .net and com dlls) in particular folder and register each dll. Is there a way to identify each dll type (.net/com) and use regasm/regsvr depending on the type of the dll.
I have a code which loops through .net dlls in a folder and register each one. The code can be found here. In this case, all the dlls were .net type. How to achieve the same with both dlls present in the same folder.
The following function(s) (originally based on a same named method from
this article
) might help you to determine if a file specified by theFileName
parameter is a .NET assembly or not. As its name proclaims, it should return True if the file is a .NET assembly, False if not. This function should work for 32-bit as well as for 64-bit libraries.Please note that this code in its modification will work only in Unicode Inno Setup. It's not intended to be used with ANSI versions of Inno Setup. For ANSI versions use the helper functions posted below:
To use the above code in the ANSI version of Inno Setup replace the above helper functions with these. It is important to do that, because streams in Inno Setup can use only string as a buffer and just strings has different size in bytes per char in Unicode and ANSI version of Inno Setup:
The usage of the above function is then straightforward: