<?include Config.wxi?>

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
  <Product Id="*" Name="$(var.ProductName)" Language="1031" Codepage="1252" Version="$(var.ProductVersion)" Manufacturer="$(var.Manufacturer)" UpgradeCode="$(var.UpgradeCode)">
    <Package
      Id="*"
      Keywords="Installer"
      Description="$(var.Description)"
      Comments="$(var.Comments)"
      Manufacturer="$(var.Manufacturer)"
      InstallerVersion="100"
      Languages="1031"
      Compressed="yes"
      SummaryCodepage="1252"
      InstallScope="perMachine"
    />

    <Property Id="APPLICATIONFOLDER">
      <RegistrySearch Key="Software\[Manufacturer]\[ProductName]" Root="HKCU" Type="raw" Id="APPLICATIONFOLDER_REGSEARCH" Name="Path" />
    </Property>

    <Media Id='1' Cabinet='$(var.ProgramName).cab' EmbedCab='yes' DiskPrompt='$(var.ProgramName)'  />
    <Property Id='DiskPrompt' Value="$(var.ProgramName) Install" />

    <MajorUpgrade
      AllowDowngrades="no"
      AllowSameVersionUpgrades="no"
      DowngradeErrorMessage="Eine neuere Version von [ProductName] ist bereits installiert. Das Setup wird beendet."
    />

    <Property Id="PREVIOUSVERSIONSINSTALLED" Secure="yes" />
    <Upgrade Id="$(var.UpgradeCode)">
      <UpgradeVersion
        Minimum="1.0.0.0" Maximum="99.0.0.0"
        Property="PREVIOUSVERSIONSINSTALLED"
        IncludeMinimum="yes" IncludeMaximum="no" />
    </Upgrade>

    <!-- Legt das Icon fest -->
    <Icon Id="AppIcon.exe" SourceFile="..\Supplywatch\bin\$(var.Configuration)\$(var.ProgramName).exe" />
    <!-- Zeige Icon in Systemsteuerung > Programme entfernen -->
    <Property Id="ARPPRODUCTICON" Value="AppIcon.exe" />

    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder">
        <Directory Id="DDDIR" Name="$(var.Manufacturer)">
          <Directory Id="INSTALLDIR" Name="$(var.ProductName)"/>
        </Directory>
      </Directory>
    </Directory>

    <DirectoryRef Id="INSTALLDIR">
      <Component Id="MainApplicationExe" Guid="AAB7930C-B559-4D67-B6BE-DEC6617461F3">
        <File Id="MainApplicationExe" Source="..\$(var.ProgramName)\bin\$(var.Configuration)\SUPPLYWATCH.exe" Name="$(var.ProgramName).exe" KeyPath="yes" Checksum="yes">
          <Shortcut Id="DesktopShortcut" Directory="DesktopFolder" Name="$(var.ProductName)" WorkingDirectory="INSTALLDIR" Icon="AppIcon.exe" IconIndex="0" Advertise="yes" />
          <Shortcut Id="StartMenuShortcut" Directory="ProgramMenuDir" Name="$(var.ProductName)" WorkingDirectory="INSTALLDIR" Icon="AppIcon.exe" IconIndex="0" Advertise="yes" />
        </File>
      </Component>

      <Component Id="DevExpressLibs" Guid="CB40DAAE-348E-4BD3-B275-9A526EB8F191">
        <File Id="DevExpress.Data.v15.2" Name="DevExpress.Data.v15.2.dll" Source="D:\ProgramFiles\DevExpress 15.2\Bin\Framework\DevExpress.Data.v15.2.dll" KeyPath="yes"/>
        <File Id="DevExpress.Printing.v15.2.Core" Name="DevExpress.Printing.v15.2.Core.dll" Source="D:\ProgramFiles\DevExpress 15.2\Bin\Framework\DevExpress.Printing.v15.2.Core.dll"/>
        <File Id="DevExpress.Utils.v15.2" Name="DevExpress.Utils.v15.2.dll" Source="D:\ProgramFiles\DevExpress 15.2\Bin\Framework\DevExpress.Utils.v15.2.dll"/>
        <File Id="DevExpress.XtraEditors.v15.2" Name="DevExpress.XtraEditors.v15.2.dll" Source="D:\ProgramFiles\DevExpress 15.2\Bin\Framework\DevExpress.XtraEditors.v15.2.dll"/>
        <File Id="DevExpress.XtraGrid.v15.2" Name="DevExpress.XtraGrid.v15.2.dll" Source="D:\ProgramFiles\DevExpress 15.2\Bin\Framework\DevExpress.XtraGrid.v15.2.dll"/>
        <File Id="DevExpress.XtraLayout.v15.2" Name="DevExpress.XtraLayout.v15.2.dll" Source="D:\ProgramFiles\DevExpress 15.2\Bin\Framework\DevExpress.XtraLayout.v15.2.dll"/>
        <File Id="DevExpress.XtraPrinting.v15.2" Name="DevExpress.XtraPrinting.v15.2.dll" Source="D:\ProgramFiles\DevExpress 15.2\Bin\Framework\DevExpress.XtraPrinting.v15.2.dll"/>
      </Component>
      <Component Id="MicrosoftLibs" Guid="1D1EE1AF-0A42-4A8C-922E-84AE50F10209">
        <File Id="Microsoft.Office.Core.Data.v15.2" Name="Office.dll" Source="C:\WINDOWS\assembly\GAC_MSIL\Office\15.0.0.0__71e9bce111e9429c\Office.dll" KeyPath="yes"/>
        <File Id="Microsoft.Office.Interop.Excel" Name="Microsoft.Office.Interop.Excel.dll" Source="C:\WINDOWS\assembly\GAC_MSIL\Microsoft.Office.Interop.Excel\15.0.0.0__71e9bce111e9429c\Microsoft.Office.Interop.Excel.dll"/>
        <File Id="Microsoft.ReportViewer.Common" Name="Microsoft.ReportViewer.Common.dll" Source="E:\SchreiberM\Visual Studio\GIT\Supplywatch\packages\Microsoft.Reporting.WinForms.v11.1.0.0.0\lib\Microsoft.ReportViewer.Common.dll"/>
        <File Id="Microsoft.ReportViewer.ProcessingObjectModel.DLL" Name="Microsoft.ReportViewer.ProcessingObjectModel.DLL" Source="E:\SchreiberM\Visual Studio\GIT\Supplywatch\packages\Microsoft.Reporting.WinForms.v11.1.0.0.0\lib\Microsoft.ReportViewer.ProcessingObjectModel.DLL"/>
        <File Id="Microsoft.ReportViewer.WinForms.DLL" Name="Microsoft.ReportViewer.WinForms.DLL" Source="E:\SchreiberM\Visual Studio\GIT\Supplywatch\packages\Microsoft.Reporting.WinForms.v11.1.0.0.0\lib\Microsoft.ReportViewer.WinForms.DLL"/>
        <File Id="Microsoft.SqlServer.Types.dll" Name="Microsoft.SqlServer.Types.dll" Source="E:\SchreiberM\Visual Studio\GIT\Supplywatch\packages\Microsoft.Reporting.WinForms.v11.1.0.0.0\lib\Microsoft.SqlServer.Types.dll"/>
        
      </Component>  
      <Component Id="RegistryKeys" Guid="4503BF18-22F2-4DBF-B281-06DE039F52C8">
        <RegistryKey Root="HKCU" Key="Software">

          <RegistryKey Key="[Manufacturer]">
            <RegistryKey Key="[ProductName]" ForceCreateOnInstall="yes" ForceDeleteOnUninstall="yes" Id="REGKEYINSTALLDIR">
              <RegistryValue Type="string" Value="[INSTALLDIR]" Name="Path" />
            </RegistryKey>
          </RegistryKey>

        </RegistryKey>

        <util:RemoveFolderEx Id="RemoveApplicationFolder" On="uninstall" Property="APPLICATIONFOLDER" />
      </Component>

      <Directory Id="ProgramMenuFolder" Name="Programs">
        <Directory Id="ProgramMenuDir" Name="Supplywatch">
          <Component Id="ProgramMenuDir" Guid="84FC82EA-EF4F-4246-A463-B076E878DF0A">
            <RemoveFolder Id="ProgramMenuDir" On="uninstall" />
            <RegistryValue Root="HKMU" Key="Software\[Manufacturer]\[ProductName]" Type="string" Value="" KeyPath="yes" />
          </Component>
        </Directory>
      </Directory>

      <Directory Id="DesktopFolder" Name="Desktop"></Directory>
    </DirectoryRef>

    <Feature Id="MainApplication" Title="Main Application" Level="1">
      <ComponentRef Id="MainApplicationExe" />
      <ComponentRef Id="RegistryKeys" />
      <ComponentRef Id="DevExpressLibs" />
      <ComponentRef Id="MicrosoftLibs" />
      <ComponentRef Id="ProgramMenuDir" />
    </Feature>

    <!-- Legt das Standard-Installationsverzeichnis fest-->
    <Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />

    <UI>
      <UIRef Id="WixUI_InstallDir" />
      <UIRef Id="WixUI_ErrorProgressText" />
      <Publish Dialog="WelcomeDlg"
            Control="Next"
            Event="NewDialog"
            Value="InstallDirDlg"
            Order="2">1</Publish>
      <Publish Dialog="InstallDirDlg"
            Control="Back"
            Event="NewDialog"
            Value="WelcomeDlg"
            Order="2">1</Publish>
    </UI>
  </Product>
</Wix>