Total MSI File size exceeding 2GB

Jan 17 at 10:41 AM
Hi,

My total file size within an Wix# project including data exceeds 2GB and currently I am unable to create Setup. Read in Wix documentation that multiple cab will solve the issue. How can I do that in Wx#
Coordinator
Jan 18 at 12:39 PM
You can add as many Media elements as you need with XML post-processing:
project.WixSourceGenerated += Compiler_WixSourceGenerated;
...
static void Compiler_WixSourceGenerated(XDocument document)
{
    document.Root
            .Select("Product")
            .AddElement("Media", "Id=1; Cabinet=MyProduct1.cab; EmbedCab=no")
            .AddElement("Media", "Id=2; Cabinet=MyProduct2.cab; EmbedCab=no")
            .AddElement("Media", "Id=3; Cabinet=MyProduct3.cab; EmbedCab=no");
...
And when you add a file you can always pass the desired media id:
new File(@"Files\Bin\MyApp.exe") { AttributesDefinition = "DiskId=2" }
But I cannot say I like this solution. The MediaTemplate element is much more elegant approach as it (with a single element) defines the splitting algorithm without explicit mapping cabs and files.

Approach is the same:
document.Root.Select("Product/Media").Remove(); //don't need it any more
document.Root.Select("Product")
             .AddElement("MediaTemplate", "MaximumCabinetSizeForLargeFileSplitting=2048");
You can even drop the MaximumCabinetSizeForLargeFileSplitting=2048 as it is a default value anyway.


I think it is a good feature to go to default features set. Please log the feature request on GitHub and I will implement it as something like this:
project.MediaTemplate = new MediaTemplate{MaximumCabinetSizeForLargeFileSplitting=2048};
//or
project.Cabs = MediaTemplate.Default; 
Please use GitHub for any further discussions: https://github.com/oleg-shilo/wixsharp