I have created two merge modules. Lets call them A and B. Merge Module B is dependent on A. A installs aaa.dll to windows side-by-side. B contains bbb.dll which registers during installation and is dependent on aaa.dll. As a side note merge module A was created in Install shield 2012 and merge module B was create using the visual studio 2010 wizard.
I have an install shield project which installs both merge modules. I go into Application Data->Redistributables and add B to the installation. This automatically checks off A. If I go to Organization->Setup Design and expand the feature which contains B then click B. It brings up the window with information regarding B. In there there is a Dependencies heading which correctly lists A.
I build the project and attempt to install it on a clean VM. During the installation I get an error saying bbb.dll has failed to register would I like to ignore, cancel. At this point I looked in winsxs on the machine and notice that aaa.dll does not exist in it's proper folder. Rather it exists in a winsxs\InstallTemp\ subfolder. Then if I click ignore on the error popup, the installation continues without further errors. Then after it has completed I can manually register bbb.dll just fine, and aaa.dll exists in the proper winsxs subfolder.
My question is how can I get merge module A to completely finish and place aaa.dll in the correct location so everything will install correctly?
Sorry for the wall of text and any improper grammar\spelling. I will post if I figure out the issue myself just in case someone else eventually runs into this problem because it is really frustrating.
Files targeting the WinSXS and GAC aren't actually installed until commit phase execution because the API that publishes them doesn't support rollback operations. This means if you are using Self Registration on a DLL that depends on the file going to the WinSxS it won't work because you have a race condition. B.DLL will try to do a LoadLibrary() on A.DLL when calling DllRegisterServer and it won't find it.
Several work arounds:
1) Don't use Self Registration. Extract the COM data at design or build time as is the best practice.
2) Deploy A.DLL to another directory such as INSTALLDIR.
3) Wrap A.DLL up into it's own MSI and wire it up to your MSI as a setup prerequiste. This will install A in it's own transaction before starting the installation of your MSI.