Inno Setup nLite Addon Tips: Reducing Installer Size and Enhancing Compatibility

Inno Setup nLite Addon Tips: Reducing Installer Size and Enhancing Compatibility

1) Choose efficient compression

  • Compression: Use LZMA2 with an appropriate level (e.g., lzma2/normal or lzma2/fast) to balance size vs memory/time.
  • SolidCompression: Enable when packaging many similar files for better ratio; disable if you need random-access extraction or patch-friendly outputs.
  • MergeDuplicateFiles: Enable to avoid embedding identical file copies.

2) Exclude unnecessary files

  • Strip dev/build artifacts: Remove .pdb, .obj, source, temp, and README files before packaging.
  • Exclude unneeded locales/skins/drivers: Only include languages and components your target needs.
  • Use wildcards selectively: Add explicit include/exclude patterns in [Files] to avoid accidentally bundling large unwanted files.

3) Split large bundles and use external packages

  • On-demand components: Make optional components (drivers, language packs) downloadable at install time instead of bundling them.
  • Use Downloads feature: Inno Setup can download large dependencies during installation rather than embedding them.

4) Optimize nLite integration

  • Strip unnecessary nLite packs: When building nLite-based addons, include only the service packs, drivers, and tweaks required for the target image.
  • Preprocess/flatten: If nLite produces many small files, consider packaging them into a single archive and extracting at install time; this reduces compression overhead on small files.

5) Improve compatibility across Windows versions

  • ArchitecturesAllowed: Set appropriate architectures (x86/x64/arm64) to avoid shipping wrong binaries.
  • MinVersion/OnlyBelowVersion: Use these to guard feature-specific files and avoid installing incompatible components.
  • RedirectionGuard/DEP/ASLR flags: Use [Setup] directives (DEPCompatible, ASLRCompatible, RedirectionGuard) to match target system capabilities when needed.

6) Use installer logic to avoid redundant installs

  • Version checks: In [Code] or [Files], check existing versions and skip copying if identical/newer is present.
  • MergeDuplicateFiles + Checksum: Ensure identical files are deduplicated; use checksums to detect changed files.

7) Sign and test installers

  • Code signing: Sign large installers to avoid SmartScreen blocks; if you split downloads, sign each executable.
  • Test on VMs: Validate installs on clean images for each target Windows version and architecture.

8) Other practical tweaks

  • CompressionThreads / LZMANumBlockThreads: Increase for faster builds on multi-core machines (may use more RAM).
  • DiskSliceSize / SlicesPerDisk: Only needed for spanning; avoid unless required.
  • OutputBaseFilename / OutputDir: Use clear naming and separate build outputs for different configurations to prevent accidental bundling.

If you want, I can generate a sample Inno Setup [Setup] compression block and a small [Files]/[Code] example showing deduplication, conditional downloads, and version checks.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *