Search code examples
wixwindows-installercabwixsharp

WixSharp: how to package a large folder into a single MSI file without getting 'The system cannot open the device or specified file' error


I'm using WixSharp v1.9.2 to create an MSI file. Since I need to package a very large folder, I create the project like this:

var project = new Project(
    ProjectName,
    ...
    new MediaTemplate {
        CompressionLevel = CompressionLevel.mszip,
        EmbedCab = true,
        MaximumUncompressedMediaSize = 1000,
        MaximumCabinetSizeForLargeFileSplitting = 2048,
    },
    ...
);

This produces an MSI file correctly sized at almost 3GB. However, when I try to execute it, I get the error The system cannot open the device or specified file.

To fix this, I tried setting the EmbedCab property to false. This seems to work correctly, but this time, in addition to the MSI file, CAB files are also generated.

Is there a way to package everything into a single MSI file?


Solution

  • Sadly there is no such a way, . The maximum size of msi is 2Gb (not exactly, there are some details, but it does not change the situation as a whole). A lot of additional details may be found here https://sqa.stackexchange.com/questions/2672/what-is-the-maximum-size-that-a-msi-windows-installer-file-can-be (see comments under the answer) and here What is the largest size that a single .msi windows package installer file can be?. And here for bootstrapped msi WiX Toolset bundle with total content size > 2GB

    The only workaround I know is to use external cabs (as you already tried to do).

    In case you are not limited to the raw msi, you can try to wrap the package (msi+cab's) with any self-extracting archive, such as WinRar. It can be configured to to automatically run msi after the extraction + some (limited) UI customization of the self-extract archive is possible.