MAKEMSI quickly and reliably creates MSI files in a non-programmatic way
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
[Bottom][Contents][Prev]: Installation Performance[Next]: Troubleshooting
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
\->Tips and Tricks->Size

Size

The section contains tips for keeping down the size of any generated MSIs, some facts:

  1. Duplicated Large Files
    If a file exists in more than one place on the destination then by default its contents will be included multiple times in the MSI. Have a look at the "DuplicateFile" table.

  2. Size of Strings
    Do not worry too much about the size of the component or other names as all strings are only stored once in a Windows Installer "string pool". If a component name "abc" or "abc...xyz" is used in 1000 places the total difference is still only 23 characters.

    Note that only the whole string is pooled, Windows Installer is not smart enough to pool substrings.

    You can use the SDK tool "MsiInfo.Exe" to validate or display the string pool.

  3. Size of Fragments of Text
    If you have a long string which is part of a number of other strings (so won't be "pooled") you could create a property with a short name and use property replacement for all columns that support "formatted" values.

  4. Graphics
    The size of any branding bitmaps or other graphics or icons will of course have some effect on the file size. Its worth spending some time to try to minimise the file size either by reducing the quality (and/or number of colors) or by playing around with the graphic options (for example "RLE encoding" can greatly reduce file size of bitmaps - in general - test all options).

  5. Shortcut Icons
    Never ever use the original program EXE or DLL as the icon source for shortcuts, extract the needed icons (see the "Icon Tools" section). I'd also ensure the extracted icons have as few formats/sizes as possible.

  6. EXE & DLL in Binary Streams
    If you are adding executable binaries (perhaps using the "Binary" or "DllCa-C" commands) then you may want to consider using the free "UPX.EXE" or similar executable compression tool. Unlike files, binary resources can't be stored in a compressed format.

  7. Alternative Compression
    If you are really short on space you might be able to add files to your own "zip", "rar" or other archive and run the decompression tool as a custom action.

  8. Export and Re-Import into New MSI
    The SDK lists this as an option, not only is this error prone and dangerous, it is also very difficult and may not process all important details.

    Note that the SDK "sample" script will fail if its fullname contains spaces and that "ORCA" import/export can create bigger files...

    Other people recommend "ORCA" "save as", however this is crippled and may not save all of the MSI!

  9. Multiple Save Inefficiencies
    Windows Installer can create MSIs with "empty" space if you add a resource save the MSI and reopen and edit or remove it.

    The most likely reason for this would be if you are making a lot of changes to the initial template. Normally MAKEMSI uses "uisample.msi" as the template but you could use "ORCA"" to export its contents and then import the generated files:

    #define? COMPANY_MSI_TEMPLATE_IDT_DIR  <??*MAKEMSI_DIR>Samples\TryMe\Create MSI Installers\ExportedIdt(UISAMPLE.MSI)
    #(
       ;--- Allow user to use another method for getting template data ----------
       #define? COMPANY_GET_TEMPLATE_AND_OPEN_MSI
    
       ;--- Start with an Empty MSI ---------------------------------------------
       <$Msi "<$ProdInfo.MsiName>.msi" CREATE="Y">
    
       ;--- Import the IDT (previously exported all tables with "orca.exe") -----
       <$TableImportFromIdt "<$COMPANY_MSI_TEMPLATE_IDT_DIR>\*.idt">
    #)

  10. Unneeded Tables or Table Contents
    Subject to the "Multiple Save Inefficiencies" issue deleting unneeded rows or tables could potentially save significant space, some ideas:

    1. The default "_Validation" table requires about 37K! MSI and row Validations need this table. Default row validation would need changing if the table didn't exist (to remove the "MISSINGDATA" error messages).

    2. If you did not want a user interface you could remove a few large tables as well as any related graphics.

  11. Compress Whole MSI
    I found a commercial tool called "Setup Squeezer" which looks interesting.

    Another approach could be to use an archive tool that creates self extracting EXE (and can execute the file on extraction).

  12. Any other tips?
    Let me know if you have one! Thanks.


Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.Please email me any feedback, additional information or corrections.
See this page online (look for updates)

[Top][Contents][Prev]: Installation Performance[Next]: Troubleshooting


MAKEMSI© is (C)opyright Dennis Bareis 2003-2008 (All rights reserved).
Saturday May 28 2022 at 3:11pm
Visit MAKEMSI's Home Page
Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.