I was looking for a way to solve the problem of Windows’ concurrent (nested) installations as described in the URL: http://msdn.microsoft.com/en-us/library/aa368010(VS.85).aspx. My goal is to wrap an MSI based InstallShield EXE or MSI within the Visual Studio Windows Installer Project. I was able to find some useful tips online, and I have converged the information and found a solution described below. I also found Arnaldo Sandoval's "Installer Class and Custom Actions" article very helpful (URL: http://www.devcity.net/Articles/339/1/article.aspx).
How it works
I created two projects in the solution:
- InstallerHelper – A console application project with C# code to enable code based custom actions.
- MsiInstaller – A Windows installer project that creates the MSI.
First, for the InstallerHelper project, I created two simple classes:
InstallerClass - This installer class overrides the base installer class to provide additional functionality for Custom Actions.
InstallerHelper - This helper class is used to invoke the MSI based InstallShield EXE or MSI.
In general, the
InstallerClass class calls the
InstallerHelper class to invoke the MSI based InstallShield EXE or MSI. Here is what I have achieved in my MSI installer demo:
Next, for the MsiInstaller project, I added to the File System both the output from the InstallerHelper project, and the MSI based InstallShield EXE or MSI to be installed on the target machine. I found that you can actually drag and drop multiple dependency files and folders to the File System view.
I added the primary output InstallerHelper as the Custom Actions for all.
This achieves the goal of invoking an MSI within a Visual Studio Windows Installer Project. When I run the MSI, it will first install the MSI based InstallShield EXE or MSI, but not executing it. Then, it runs the InstallerHelper which kicks-off the EXE or MSI.
A tip I found is that if the imported MSI based InstallShield EXE or MSI already contains Custom Actions, which is very common, then when you add the EXE or MSI to the Visual Studio Windows Installer Project, the Custom Actions is carried over to the Windows Installer Project. This gives the undesirable result of concurrent installation because some of the Custom Actions from the embedded MSI are invoked while the wrapper MSI is running. A simple solution is to use Orca.exe, select the CustomAction, and delete the ones that are being imported form the embedded EXE or MSI install process.
- Feb 2009 - first release.