We have a setup project that produces an uncompressed MSI file and no Setup.exe at all, to be later compressed by NSIS.
In a special build setting, I want to copy that MSI before it's being wrapped by NSIS, change the copy, and keep it. I would also like to compress it, after it has been created by the msbuild.
Is there a simple way (command line tool of some kind, maybe?) I can use to just compress an already created msi file?
views:
128answers:
2Yes! See the Windows SDK :)
There are a bunch of example scripts showing how to manipulate MSI files using the Windows Installer API.
An MSI file itself is never actually compressed, however it can contain embedded CAB files which may be compressed.
I would suggest putting together some script that extracts any embedded CAB files from the MSI, uncompresses them one at a time to a temporary folder, re-compresses using better compression, then replaces the non-compressed CAB inside the MSI with the newly compressed one.
Any tool you can find will do exactly what I've mentioned above, however putting it together yourself should provide a deeper understanding of how MSI works :)
Converting MSI from uncompressed to compressed.
- Do an admin installation of the msi.
- Use PATCH to pass the patch files you want on it.
- Copy WiFilVer.vbs and WiMakeCab.vbs files from
"C:\Program Files\Microsoft SDKs\Windows\v7.0\Samples\sysmgmt\msi\scripts"
to the admin install folder. - To update the files with the new ones run:
CScript //nologo WiFilVer.vbs vendormsi.msi /U
- To create cab file and embed it into the msi:
cscript /nologo WiMakCab.vbs eTalk.msi Data1 /R /L /C /U /E /S
- If you don’t get a cab file from step 5 check your Media table in Orca and take a look at: "http://www.spinnersoftware.com/kb/en/msi/createmsi.html" look for the section on compressing.
- You should now have an msi which includes everything.
Compressing an MSI with an internal or external cab file
- Do an admin installation of the msi.
- Use PATCH to pass the patch files you want on it.
- Copy the WiMakeCab.vbs file from the Windows SDK to the admin install folder.
- Run: cscript WiMakCab.vbs Vendor.msi Data1 /L /C /U /E
- You should have an MSI with embedded cab file.