Maximum compression of a MSI install using WIX

2019-04-25 08:08发布

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!

2条回答
女痞
2楼-- · 2019-04-25 08:12

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.

查看更多
相关推荐>>
3楼-- · 2019-04-25 08:27

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

查看更多
登录 后发表回答