You can add as many Media elements as you need with XML post-processing:
And when you add a file you can always pass the desired media id:
But I cannot say I like this solution. The
Approach is the same:
You can even drop the
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:
Please use GitHub for any further discussions: https://github.com/oleg-shilo/wixsharp
project.WixSourceGenerated += Compiler_WixSourceGenerated; ... staticvoid 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"); ...
new File(@"Files\Bin\MyApp.exe") { AttributesDefinition = "DiskId=2" }
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");
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;