How to Read Configuration

Configure your package fragment installer in install.xml and read the configuration in your code

The package fragment installer can be configured via install.xml and its configuration should be placed within mi:PackageFragmentInstallers/mi:Add[@installerType="{the full name of the installer}"].

<mi:PackageFragmentInstallers>
	<mi:Add
		  installerType="Namespace.InstallClassName, AssemblyName"
		  uninstallerType="Namespace.UninstallClassName, AssemblyName ">
		  <!-- the package fragment installer's configuration -->
	</mi:Add>
</mi:PackageFragmentInstallers>
In many cases, it would be a parent element with or without attributes, which lists one or more child elements with one or more attributes.

Model:

<InstallerParentElement>
    <InstallerChildElement attr1="value11" attr2="value12" />
    <InstallerChildElement attr1="value21" attr2="value22" />
    <InstallerChildElement attr1="value31" attr2="value32" />
</InstallerParentElement>
In your fragment installer's code you can use the Configuration property to access the installer's configuration in install.xml and read the related values:

XElement parentElement = this.Configuration.SingleOrDefault(f => f.Name == "InstallerParentElement");

if (parentElement != null)
{
    foreach (XElement childElement in parentElement.Elements("InstallerChildElement"))
    {
        XAttribute attr1 = childElement.Attribute("attr1");
        XAttribute attr2 = childElement.Attribute("attr2");

        if (attr1 != null)
        {
            // your code goes here
        }
        
        // your code goes here
    }
}