how to register DLL's properly in wix 3.9

1.1k views Asked by At

I am building an installer and use heat.exe to harvest all the required files. however I need to register some DLL and OCX files, I looked around how to do it bud there seems te be some debate aboud how to implement registering those files, on stackoverflow as well as on other websites and forums. I would like to use the following: SelfRegCost="1" since it looks like the most simple way to register files. bud people dont like it because it could give problems when repairing or uninstalling the program.

what is your opinion regarding this method and what would you suggest me? a example of the code implementation recommended would be highly appreciated.

thanks in advance.

1

There are 1 answers

6
Christopher Painter On

Simply put, any form of self registration (COM being one of them) is an antipattern. There are various reasons a few of which are:

1) They add fragility to the install

2) They can halt a silent install when they fail.

3) They don't log any information on why they failed.

4) They are out of process; the installer isn't aware of them (no repair)

5) They break the transactional nature of Windows Installer (no rollback)

6) They slow the install down

7) They hide implementation details and can't be observed or transformed

I'd go so far to say this isn't a matter of opinion but rather a matter of best practice facts. But I suppose at the end of the day best practices are just opinions also. Still, I've authored thousands of installers over the last 20 years and I can say without a doubt that self registration should be skipped whenever possible. Instead use Heat to "harvest" the COM meta data and author it into your wxs code so MSI can handle this natively for you. There are other tricks that can be employed if Heat is unable to get all the details.

Finally, don't use COM whenever possible. For example you could consider using a RegFree COM manifest instead to simulate the registration of the component.

See: Do not use the SelfReg and TypeLib tables.