If you build installers based on msi technology, then most probably you get frustrated of building the installer again and again due to minor changes. This mostly occurs, if you have big size installers which takes longer time to build and when you test it, there comes problems due to mistakes in your Custom Actions.
For instance, I used to work with VbScript based Custom Actions mostly and lots of times, installer fails/crashed or give unexpected results, because of very small mistakes like absence of Quotes, missing character in function calls, wrong parameters etc..
So there are several methods to avoid building your large MSI again and again. I’m mentioning here only those which I experimented with and found beneficial.
For instance, I used to work with VbScript based Custom Actions mostly and lots of times, installer fails/crashed or give unexpected results, because of very small mistakes like absence of Quotes, missing character in function calls, wrong parameters etc..
So there are several methods to avoid building your large MSI again and again. I’m mentioning here only those which I experimented with and found beneficial.
Note: This tool and others are part of Windows Installer Development Tools, which are part of Microsoft Windows SDK.
I’ve discussed 2 methods here:
Using Microsoft Orca:
If you have use Microsoft Orca, The MSI Database Editor, then you might be aware that we can import/export tables and data from MSI using it. And I used this feature many times to Export VBScript custom action, update that and then Import back into the MSI and that’s it. Here are steps.:
Using Microsoft MsiDB.exe:
Like Microsoft Orca, this tool also has the ability to Import and Export, tables and their data from your MSI files. But, unlike Orca, MSIDB can do it at command line and so it is very much useful to be used in Bat procedures.
If you have installed Microsoft Windows SDK, then this and many other tools would be installed in C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\
By executing MsiDB.exe /?, you can see its parameter options. Here is the dialog which would appear if you execute MsiDB.exe /? :
So first step is to export Binary table and its data, which contains your Custom Actions. We may not need to export it again and again, so we can also do the export thing using Orca. To do this in Orca, from Tables menu, select “Export Tables” and you’ll get a dialog listing all the tables and option to select a folder in which exported data would be saved.
If you wish to use MsiDB to export tables, issue this command:
MsiDB.exe –d MyInstaller.msi –e Binary –f C:\MyExportedTables\
In both cases, when you’ll export Binary table, C:\MyExportedTables\ would contain
- Binary.idt: This is the Table Definition file and contains the text based database columns and entries.
- Binary folder, which contains the contents referenced in Data columns of Binary.idt file.
Name | Data | |
s72 | v0 | |
Binary | Name | |
MyCA.vbs | MyCA.vbs.ibd | |
WixUIWixca | WixUIWixca.ibd | |
WixUI_Bmp_Banner | WixUI_Bmp_Banner.ibd | |
WixUI_Bmp_Dialog | WixUI_Bmp_Dialog.ibd | |
WixUI_Bmp_New | WixUI_Bmp_New.ibd | |
WixUI_Bmp_Up | WixUI_Bmp_Up.ibd | |
WixUI_Ico_Exclam | WixUI_Ico_Exclam.ibd | |
WixUI_Ico_Info | WixUI_Ico_Info.ibd |
So I suggest, you should rename MyCA.vbs.ibd to MyCA.vbs so that your code editor can recognize it and you can easily update it.
Now open Binary.idt file in any text editor and simply update MyCA.vbs.ibd to MYCA.vbs and save the file.
You can now use MsiDB.exe again to import Binary.idt (Table definition) back to your MSI file. Here is the command I’m using:
MsiDB.exe –d MyInstaller.msi –i Binary.idt –f C:\MyExportedTables\
This will also import our MyCA.vbs back into MSI file.So, using above procedures, you can now create a .bat procedure which would be updating and launching your MSI, without building it. On the other hand, you can keep working with your vbs file. Here is a sample .bat file listing depicting the use of above referenced methods:
1: @echo off
2: MsiDB –d MyInstaller.msi –i Binary.idt –f C:\MyExportedTables\
3: Msiexec /i MyInstaller.msi /log MyInstaller.log
Now you keep updating your custom action in your favorite editor and whenever wanted to run your MSI, simply invoke this .bat script. As you can see in line 3, MsiExec is calling your msi while logging the installation. This greatly helps to get your script errors being logged in Myinstaller.log.
TIP: Analyze your MSI logs with Another tool WiLogUtl.exe which can be found in same folder where MsiDB.exe is present.
(Back to topic selection)
No comments:
Post a Comment