Compression Methods

Feb 11, 2016 at 8:54 PM
Edited Feb 11, 2016 at 9:53 PM
Does anyone know what type of compression methods Wix is using?
What is the default?

Can we select the type of compression we want in WixSharp?

(This pertains to an MSI file.)

Thanks!
Feb 11, 2016 at 10:19 PM
I found out that if we add to the attributedefinitions we can specify compression for what becomes a <Media> element.
project.Media.AttributeDefinitions += ";CompressionLevel=high"
This reference has all the attributes that are available: http://wixtoolset.org/documentation/manual/v3/xsd/wix/media.html

NOTE: not all of the attributes are implemented.

Based on this page: http://wixtoolset.org/documentation/manual/v3/xsd/wix/simple_type_compressionleveltype.html

The valid values for "CompressionLevel" are:
  • high
  • medium
  • low
  • mszip
  • none
Oleg, is there any way we can get this attribute exposed as a C# property? I'm still trying to wrap my head around how the project builds the XML so I don't feel comfortable writing code to submit for you.
Coordinator
Feb 13, 2016 at 3:53 AM
OK, Done. The next release will deliver a complete support Media element:
project.Media.Id=1;
project.Media.CompressionLevel=CompressionLevel.high;

Implementing Media is actually quite easy as it maps straightforward into a single child XML element of the Product element:
public enum CompressionLevel
{
    high,
    medium,
    low,
    mszip,
    none
}
...
public class Media : WixObject
{
    [Xml]
    public int Id = 1;
    [Xml]
    public CompressionLevel? CompressionLevel;
    [Xml]
    public bool? EmbedCab = true;
...
    public XContainer ToXml()
    {
        return new XElement("Media")
                   .AddAttributes(this.MapToXmlAttributes())
                   .AddAttributes(this.Attributes);
    }
}
...
//in Compiler.GenerateWixProj
product.Add(project.Media.ToXml());