<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">

  <!-- SECTION A - Package definitions and checks -->
  
  <Product Id="*" Name="SimpleEAMenuInstaller" Language="1033" Version="1.0.0.0" Manufacturer="EXploringEA" UpgradeCode="YOURUPGRADE-GUID-4EA9-80C1-EEFC5473F3CE">
    <Package InstallerVersion="500" Description ="This is the Simple Addin Installer" Compressed="yes" InstallScope="perUser" />
    <!-- The following line prevents downgrade-->
		<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
    
    <!-- SECTION B - CHANGE -->
	<!-- By default the installer will be for HKLM but to ensue that HKCR references are translated to HKLM 
  set the following property to specify that the installation is Per Machine -->
   <Property Id="ALLUSERS" Value="1"/>
	
    <!-- END SECTION B -->
    <!-- SECTION C - installation directory structure --> 
    <Directory Id='TARGETDIR' Name='SourceDir'>
      <Directory Id='ProgramFilesFolder' Name='PFiles'> <!-- This is the root of the program files -->
        <Directory Id='AddIn' Name='EXploringEAAddins'>
          <Directory Id='INSTALLDIR' Name='SimpleAddIn'>

            <!-- SECTION D - package components -->
            <!-- This creates and removes the install folder at thr INSTALLDIR location -->
            <Component Id="InstallFolder" Guid="YOUR-GUID1-442D-A0F8-E48F0AC4BDFD" KeyPath="yes"> 
              <CreateFolder />
              <RemoveFile Id="PurgeAppFolder" Name="*.*" On="uninstall" />
            </Component>
            
            <!-- This adds and removes our Sparx AddIn key -->
            <Component Id="Sparx" Guid ="YOUR-GUID2-4385-91F7-07E3B18B3B6A" >
              <RegistryKey Root="HKLM" Key="Software\Sparx Systems\EAAddins\NameOfSimpleAddIn" ForceCreateOnInstall="yes" ForceDeleteOnUninstall="yes"> <!-- Name of my key-->
                <RegistryValue Type="string" Value="ASimpleAddin.ASimpleEAMenu" KeyPath="yes" /> <!-- This is the class name that Sparx will look for -->
              </RegistryKey>
              <RemoveRegistryKey Id='SparxKey' Root="HKLM" Key='Software\Sparx Systems\EAAddins\NameOfSimpleAddIn' Action="removeOnUninstall"/>
            </Component>
                 
            <!-- We add/remove a key that saves our installed program location (for our use) e.g. we may put other files in that location -->
            <Component Id="ProgramLocation" Guid="YOUR-GUID13-4552-9EA9-164F11839699" > 
              <RegistryKey Root="HKLM" Key="Software\EXploringEA\SimpleAddIn">
                <RegistryValue Type='string' Name='ProgramDir' Value='[INSTALLDIR]' KeyPath="yes"/> <!-- Sets the key ProgramDir to Program directory-->
              </RegistryKey>
              <RemoveRegistryKey Id='ProgLoc' Root="HKCU" Key='Software\EXploringEA\SimpleAddIn' Action="removeOnUninstall"/>
            </Component>
		
            <!-- END SECTION D -->
            
          </Directory>
          </Directory>
        </Directory>
      </Directory>
    <!-- END SECTION C -->
    
    <!-- SECTION E - package features -->
    <!-- Features define which components are in the package these are defined below-->
		<Feature Id="ProductFeature" Title="SimpleEAMenuInstaller" Level="1">
	    <ComponentGroupRef Id="DLLClasses" />
      <ComponentRef Id="InstallFolder" />
      <ComponentRef Id="Sparx" />
      <ComponentRef Id='ProgramLocation' />
    </Feature>
    <!-- END SECTION E -->
    
	</Product> <!-- End SECTION A -->
 
</Wix>