开发者

Compressing an uncompressed MSI file

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?


Yes! 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.

  1. Do an admin installation of the msi.
  2. Use PATCH to pass the patch files you want on it.
  3. 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.
  4. To update the files with the new ones run: CScript //nologo WiFilVer.vbs vendormsi.msi /U
  5. To create cab file and embed it into the msi: cscript /nologo WiMakCab.vbs eTalk.msi Data1 /R /L /C /U /E /S
  6. 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.
  7. You should now have an msi which includes everything.

Compressing an MSI with an internal or external cab file

  1. Do an admin installation of the msi.
  2. Use PATCH to pass the patch files you want on it.
  3. Copy the WiMakeCab.vbs file from the Windows SDK to the admin install folder.
  4. Run: cscript WiMakCab.vbs Vendor.msi Data1 /L /C /U /E
  5. You should have an MSI with embedded cab file.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜