Now we're ready to actually extract the files, which I do in ExtractPackageFiles. I do this in SetEngineVarsInSession by copying the properties I want from the Bootstrapper's StringVariable. You also need to set the Properties for the session. Make sure to store the old UI level so you can restore it when you're done. I also set the UI level to Silent to prevent the MSI's UI from showing. This is done using the OpenPackage method - but we need to tell it to ignoreMachineState, otherwise it will look for this MSI in the system registry and get all confused. Since we'll basically be using MSI/WiX to "install" these files, and they require a Session to run, we need to create our own session object. I do this in the UpdateMSIFeatureTableToSetInstallableFeatures method by changing the Level value in the Feature table. Otherwise, we need to modify the level values in the MSI's database to change it to 1 for those features we want and to something higher than 1 for the features we don't. So if all you want to install is the Level 1 features, you can skip this step. Anything that's a Level 1 will be installed. step 2b: set the installable features in the MSI databaseĪs I mentioned above, the Level value for each feature determines if it's installed by default of not. I do this in the UpdateMSIDirectoryTableToUseNewApplicationFolder method by changing the DefaultDir value in the Directory table. The way I achieve this is by setting it to "." (the current folder), which will override everything above it in the folder hierarchy as well. So I need to change the location of this folder in the MSI database to allow me to install somewhere other than Program Files. All of my files get installed at or below this level. Note that I have a top-level folder APPLICATIONFOLDER defined just under the ProgramFilesFolder. wix files, you should have defined a bunch of Directory targets, like this: The first thing we need to do is update the install folder. step 2a: set the install location in the MSI database So we'll interact with the database using SQL statements in order to change the behavior of the installer. Keep in mind, the MSI package is basically just a database with the files embedded. To do this, I used the WiX InstallPackage class, which wraps our MSI package. Now, we loop through each of the MSIs you want to install and use the InstallPackage method to actually extract the files from them into your target folder. This throws the MSI files into a AttachedContainer subfolder of our temp working folder. This is actually pretty straightforward using the WiX Unbinder class. exe and place them into a temporary working folder. The ExtractComponentInstallersFromBundle method is used to extract the. Here's a high-level overview of what happens: Step 1: extract MSIs from bundle Then RunInstall() and watch the magic happen. Using my MsiFileExtractor class, you'll need to pass into the cxtr the target folder where you want the files extracted into, the list of features to be installed for each MSI, and a reference to the MBA object itself. I'm assuming you don't just want to install the defaults and that you want to select which specific features to install. This list of features to be installed for each MSI. You can get this through the WixBundleOriginalSource engine variable
0 Comments
Leave a Reply. |