<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Product Id="*" Name="NzbDrone" Language="1033" Version="$(env.BUILD_NUMBER)" Manufacturer="NzbDrone Team" UpgradeCode="56833D74-A480-4CA2-B562-5A018B3A0F99">
    <Package Description="NzbDrone"
             Comments="NzbDrone"
             InstallerVersion="200"
             Compressed="yes"
             InstallPrivileges="limited"
             InstallScope="perUser"
             Platform="x86" 
             Manufacturer="NzbDrone Team"
             />
    <Media Id="1" Cabinet="NzbDrone.cab" EmbedCab="yes" CompressionLevel="high"/>
    <Property Id="ARPPRODUCTICON" Value="ND_ICON" />
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="LocalAppDataFolder" Name="AppDataFolder">
        <Directory Name="NzbDrone" Id="SX_ROOT">
          <Component Id="SX_APP_COMP" DiskId="1" Guid="9c3ac309-cde4-4338-be75-a914cbce2601">
            <File Id="SX_EXE_FILE" Name="NzbDrone.Client.exe" Source="_raw\NzbDrone.Client.exe" />
            <File Id="AUTOFAC.CONFIGURATION.DLL" Name="Autofac.Configuration.dll" Source="_raw\Autofac.Configuration.dll" />
            <File Id="AUTOFAC.DLL" Name="Autofac.dll" Source="_raw\Autofac.dll" />
            <File Id="BCRYPT.NET.DLL" Name="BCrypt.Net.dll" Source="_raw\BCrypt.Net.dll" />
            <File Id="CALIBURN.MICRO.DLL" Name="Caliburn.Micro.dll" Source="_raw\Caliburn.Micro.dll" />
            <File Id="ICSHARPCODE.SHARPZIPLIB.DLL" Name="ICSharpCode.SharpZipLib.dll" Source="_raw\ICSharpCode.SharpZipLib.dll" />
            <File Id="MAHAPPS.METRO.DLL" Name="MahApps.Metro.dll" Source="_raw\MahApps.Metro.dll" />
            <File Id="NEWTONSOFT.JSON.DLL" Name="Newtonsoft.Json.dll" Source="_raw\Newtonsoft.Json.dll" />
            <File Id="NLOG.DLL" Name="NLog.dll" Source="_raw\NLog.dll" />
            <File Id="RESTSHARP.DLL" Name="RestSharp.dll" Source="_raw\RestSharp.dll" />
            <File Id="EXCEPTRON.CLIENT.DLL" Name="exceptron.client.dll" Source="_raw\exceptron.client.dll" />
            <File Id="EXCEPTRON.NLOG.DLL" Name="exceptron.nlog.dll" Source="_raw\exceptron.nlog.dll" />
            <File Id="NzbDrone.CLIENT.CORE.DLL" Name="NzbDrone.Client.Core.dll" Source="_raw\NzbDrone.Client.Core.dll" />
            <File Id="NzbDrone.CLIENT.CORE.PDB" Name="NzbDrone.Client.Core.pdb" Source="_raw\NzbDrone.Client.Core.pdb" />
            <File Id="NzbDrone.CLIENT.EXE.CONFIG" Name="NzbDrone.Client.exe.config" Source="_raw\NzbDrone.Client.exe.config" />
            <File Id="NzbDrone.CLIENT.PDB" Name="NzbDrone.Client.pdb" Source="_raw\NzbDrone.Client.pdb" />
            <File Id="NzbDrone.SHARED.DLL" Name="NzbDrone.Shared.dll" Source="_raw\NzbDrone.Shared.dll" />
            <File Id="NzbDrone.SHARED.PDB" Name="NzbDrone.Shared.pdb" Source="_raw\NzbDrone.Shared.pdb" />
            <File Id="SYSTEM.WINDOWS.INTERACTIVITY.DLL" Name="System.Windows.Interactivity.dll" Source="_raw\System.Windows.Interactivity.dll" />
            <RegistryValue Root="HKCU" Key="Software\Microsoft\NzbDrone" Name="installed" Type="integer" Value="1" KeyPath="yes" />
            <RemoveFolder Id="SX_ROOT" On="uninstall" />
          </Component>
        </Directory>
      </Directory>
      <Directory Id="DesktopFolder">
        <Component Id="SX_DESKTOP_SHORTCUT_COMP" Guid="1f395635-7a9d-454d-aab4-95a5a4e70be4">
          <Shortcut Id="SX_DESKTOP_SHORTCUT" Name="NzbDrone" Description="NzbDrone Backup Client" Target="[SX_ROOT]NzbDrone.Client.exe" WorkingDirectory="SX_ROOT" />
          <RegistryValue Root="HKCU" Key="Software\Microsoft\NzbDrone" Name="installed" Type="integer" Value="1" KeyPath="yes" />
        </Component>
      </Directory>
      <Directory Id="ProgramMenuFolder">
        <Directory Id="SX_START_DIR" Name="NzbDrone">
          <Component Id="SX_START_SHORTCUT_COMP" Guid="8b3d54c6-712b-4bc2-b1e9-7cf40bcc1344">
            <Shortcut Id="SX_START_SHORTCUT" Name="NzbDrone" Description="NzbDrone Backup Client" Target="[SX_ROOT]NzbDrone.Client.exe" WorkingDirectory="SX_ROOT" />
            <RemoveFolder Id="SX_START_DIR" On="uninstall" />
            <RegistryValue Root="HKCU" Key="Software\Microsoft\NzbDrone" Name="installed" Type="integer" Value="1" KeyPath="yes" />
          </Component>
        </Directory>
        <Directory Id="StartupFolder" Name="Startup">
          <Component Id="SX_STARTUP_SHORTCUT_COMP" Guid="0fdfe510-621e-4925-a0d4-395617fb7cbc">
            <Shortcut Id="SX_STARTUP_SHORTCUT" Name="NzbDrone" Description="NzbDrone Backup Client" Target="[SX_ROOT]NzbDrone.Client.exe" Arguments="/startup" WorkingDirectory="SX_ROOT" />
            <RegistryValue Root="HKCU" Key="Software\Microsoft\NzbDrone" Name="installed" Type="integer" Value="1" KeyPath="yes" />
          </Component>
        </Directory>
      </Directory>
    </Directory>
    <!--<UIRef Id="WixUI_Minimal" />-->
    <UI />
    <MajorUpgrade AllowDowngrades="no" AllowSameVersionUpgrades="yes" MigrateFeatures="yes" Schedule="afterInstallInitialize" DowngradeErrorMessage="Newer version of NzbDrone is already installed." />
    <Feature Id="DefaultFeature" Title="Main Feature" Level="1">
      <ComponentRef Id="SX_APP_COMP" />
      <ComponentRef Id="SX_START_SHORTCUT_COMP" />
      <ComponentRef Id="SX_STARTUP_SHORTCUT_COMP" />
      <ComponentRef Id="SX_DESKTOP_SHORTCUT_COMP" />
    </Feature>
    <PropertyRef Id="NETFRAMEWORK40FULL" />
    <Condition Message="This application requires .NET Framework 4.0 or later. Please install the .NET Framework then run this installer again.">NETFRAMEWORK40FULL</Condition>
    <Icon Id="SX_ICON" SourceFile="_raw\NzbDrone.Client.exe" />
    <InstallExecuteSequence>
      <InstallInitialize/>
      <Custom Action="SX_START_ACTION" After="InstallFiles" />
      <InstallFinalize/>
    </InstallExecuteSequence>
    <CustomAction Id="SX_START_ACTION" FileKey="SX_EXE_FILE" ExeCommand="" Execute="deferred" Impersonate="no" Return="asyncNoWait" />
  </Product>
</Wix>