Tuesday, April 5, 2011

Maximum compression of a MSI install using WIX

I used to build installs for an app with NSIS and the final self extractor was 1.2 MB. Now I need to use WIX due to operational needs and the same install comes out at 4.2 MB. I set the compressed flags as the docs and specs indicated on the package node. Using 7z to zip the MSI results in a 2.4 MB zip file.

Question: How can I do a maximum compress on the MSI or create a small MSI (e.g. remove unneeded resources etc) ?

Note - size is uber important and I have to use MSI/WIX now - this is a show stopper!

From stackoverflow
  • Did you try to set CompressionLevel='high' attribute in Media element? Also, I should say that WiX includes only those things you instruct it to include, hence, I don't think you can easily find anything to drop out of your package...

    MX4399 : Helped a little - 200 kb
  • The problem was an ICON element that referenced a sourcefile - the main exe - and then included the exe again, this time without compressing as a resource.

                    <Directory Id="app" Name="MyApp">
    
                    <Component Id="app.exe" DiskId="1" Guid="AGUID_123">
    
                        <File Id="app.exe" Name="app.exe" Source="..\app\app.exe" KeyPath="yes">
                            <Shortcut Id="ExeShortcut" Directory="ProgramMenuDir" Name="MyApp" Advertise="yes" Icon="StartMenuIcon.exe" IconIndex="0" />
                        </File>...
    

    And lower down:

    <Icon Id="StartMenuIcon.exe" SourceFile="..\app\app.exe" />
    

    I found it using 7Zip to open the resulting MSI file and saw a familiar file size - the uncompressed main exe.

    Resulting MSI file now 1.4 MB and on par with NSIS.

    sascha : Bitmaps can also be a cause for size blowout. Can save a fair bit by using 256 color compressed BMP files instead of 24-bit uncompressed ones :)
    MX4399 : Unfortunately the "bling" is sorely needed - most are png though

0 comments:

Post a Comment