Tuesday, October 04, 2005

InstallScript and Enumerators

I was helping a coworker out today trying to figure out why a simple VB Script using WMI could not be "ported" to InstallShield's InstallScript. The reason turned out to be that InstallScript does not support handling enumerators - In VBScript, you can enumerate a collection using the "For Each" construct. In JScript, you have the Enumerator object. In InstallScript - sadly - you have nothing.

I started thinking that I may be able to create a DLL to handle this. I then thought that someone else likely has done the same. My Google-foo came in handy and I found a post by __EDITED___ that covers the topic quite well. I was able to easily compile his C++ code into a DLL and use it immediately.

UPDATE: Turns out that the link previously referenced above was pretty much a blatent copy of code previously submitted to Installsite.org. Thank you to the commenter for pointing this out.

In the deleted link above, the poster was complaining about certain InstallShield limitations. I agree with most of the comments in his post - InstallShield's help system is at least second-rate. The InstallShield books by Baker are nice to have around, but not everyone has this luxury.

I disagree with his comments that MSI is "limited." It certainly is not the "holy grail" of installation technology - and I doubt that this can even exist. MSI technology is extremely extensible, but this comes at a cost of understanding the design patterns inherent in it - which are vastly different than the "other" installation technologies. I know I mentioned this before, but using MSI technology could practically eliminate vendor dependence and ease the switch between authoring tools.

Unfortunately, the documentation for MSI technology is equally as poor as InstallShield's. Rumor has it (plus the Amazon ratings) that Phil Wilson's book on the subject is pretty good - if Brian will ever let me borrow his copy I can give it an official review. I will attempt to help out with this by (finally) publishing my series on Custom Actions over the next several weeks.

5 comments:

Anonymous said...

I am fortunate to own a copy of Phil Wilson's book and must say that if anyone's looking to dip their toe in the MSI waters, this book would be an excellent starting point. It is a good, fast read and deals with practical issues. The official documentation is an excellent reference but hardly a great read. After this WiX is a logical next step.

Brian said...

You can quit whining, the book is now in the office.

Anonymous said...

The collection enumeration code posted on Supancic's blog is clearly stolen from the IsGetObj example on InstallSite.org. The code is nearly identical right down to function and variable names. The one on InstallSite predates Supacic's by several years and was written by an InstallShield employee.

Steven Bone said...

Thank you for your comment. The post has been updated to remove the reference to the offending site.

Mohibul Hasan said...

Thanks for informative post.