<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<installer-gui-script minSpecVersion="1">
    <title>Microsoft Remote Desktop v10.9.9</title>
    <organization>com.microsoft</organization>
    <domains enable_localSystem="true" enable_anywhere="true" enable_currentUserHome="false"/>
    <options customize="never" require-scripts="true" rootVolumeOnly="true" hostArchitectures="arm64,x86_64"/>
    <license file="eula.html" mime-type="text/html"/>
    <background file="RDC.png" mime-type="image/png" scaling="tofit" alignment="center"/>
    <background-darkAqua file="RDC-dark.png" mime-type="image/png" scaling="tofit" alignment="center"/>
    <allowed-os-versions>
        <os-version min="12.0"/>
    </allowed-os-versions>
    <!-- Component packages to be included in the distribution. -->
    <pkg-ref id="com.microsoft.autoupdate" packageIdentifier="com.microsoft.package.Microsoft_AutoUpdate.app" version="4.73.24071426" installKBytes="10864">#Office16_autoupdate_updater.pkg</pkg-ref>
    <pkg-ref id="com.microsoft.rdc.macos" version="10.9.9" installKBytes="179423">#com.microsoft.rdc.macos.pkg</pkg-ref>
    <pkg-ref id="com.microsoft.rdc.scripts" version="1.0.0" installKBytes="0">#scripts.pkg</pkg-ref>
    <!-- Choices which reference defined pkg-refs. -->
    <choices-outline>
        <line choice="com.microsoft.rdc.macos"/>
        <line choice="com.microsoft.autoupdate"/>
        <line choice="com.microsoft.rdc.scripts"/>
    </choices-outline>
    <!-- Choice definitions for each package choice above. -->
    <choice id="com.microsoft.autoupdate">
        <pkg-ref id="com.microsoft.autoupdate">
            <must-close>
                <app id="com.microsoft.autoupdate2"/>
            </must-close>
        </pkg-ref>
    </choice>
    <choice id="com.microsoft.rdc.macos">
        <pkg-ref id="com.microsoft.rdc.macos">
            <must-close>
                <app id="com.microsoft.rdc.macos"/>
            </must-close>
        </pkg-ref>
    </choice>
    <choice id="com.microsoft.rdc.scripts">
        <pkg-ref id="com.microsoft.rdc.scripts"/>
    </choice>
    <installation-check script="InstallationCheck();"/>
    <script>
	function InstallationCheck()
	{
		var result;
		try {
			result = system.compareVersions(system.version.ProductVersion, '12.0') &gt;= 0;
		} catch (e) { }

		if (!result)
		{
			my.result.type = 'Fatal';
			my.result.title = system.localizedString('require-min-os-title');
			my.result.message = system.localizedString('require-min-os-message');
		}
		return result;
	}
	</script>
    <pkg-ref id="com.microsoft.autoupdate" active="MauInstallationCheck();">
        <bundle-version>
            <bundle CFBundleShortVersionString="4.73" CFBundleVersion="4.73.24071426" id="com.microsoft.autoupdate2" path="Microsoft AutoUpdate.app"/>
        </bundle-version>
    </pkg-ref>
    <pkg-ref id="com.microsoft.rdc.macos">
        <bundle-version>
            <bundle CFBundleShortVersionString="10.9.9" CFBundleVersion="2257" id="com.microsoft.rdc.macos" path="Microsoft Remote Desktop.app"/>
        </bundle-version>
    </pkg-ref>
    <script>
    function MauInstallationCheck() {
    
        var result = true;
        var mauVersion = '4.73.24071426';
        
        try {
        
            var appPath = "/Library/Application Support/Microsoft/MAU2.0/Microsoft AutoUpdate.app";
            system.log('mau path: '.concat(appPath))
            
            if (!(system.files.fileExistsAtPath(appPath))) {
                system.log('mau doesnt exist, installing mau');
                return true;
            }
            
            system.log('installing mau version: ' + mauVersion);
            
            var bundle = system.files.bundleAtPath(appPath);
            var installedVer = bundle.CFBundleVersion;
            system.log('mau already installed, version: '.concat(installedVer));
            
            result = system.compareVersions(mauVersion, installedVer) &gt; 0;
            system.log('compareVersions result: '.concat(result));
            
            if (result) {
                system.log('installed version ' + installedVer + ' is older than ' + mauVersion + '. installing mau');
            } else {
                system.log('installed version ' + installedVer + ', is newer than ' + mauVersion + '. not installing mau');
            }
        
        } catch(e) {
            system.log('exception caught: '.concat(e));
        }
        return result;
    }
    </script>
    <pkg-ref id="com.microsoft.rdc.scripts">
        <bundle-version/>
    </pkg-ref>
</installer-gui-script>