<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
	<Product Id="FF4D100F-9833-43CB-B335-E9923812F9B9" Name="Vowpal Wabbit" Language="1033" Version="$(var.VowpalWabbitAssemblyVersion)" Manufacturer="Microsoft Research"
           UpgradeCode="ddebf366-a8ca-4192-8552-dbf1d3603ae9">
		<Package InstallerVersion="300" Compressed="yes" InstallScope="perMachine" />

		<MajorUpgrade DowngradeErrorMessage="A newer version of Vowpal Wabbit is already installed." />
		<MediaTemplate EmbedCab="yes" />

		<Feature Id="ProductFeature" Title="Vowpal Wabbit" Level="1">
      <ComponentRef Id="MainExecutable" />
      <ComponentRef Id="ApplicationShortCut" />
		</Feature>

    <Feature Id="DotNet" Title="Vowpal Wabbit Managed JSON" Level="1">
      <ComponentRef Id="DotNetExecutable" />
    </Feature>
	</Product>

	<Fragment>
		<Directory Id="TARGETDIR" Name="SourceDir">
			<Directory Id="ProgramFiles64Folder">
        <Directory Id="INSTALLDIR" Name="VowpalWabbit" >
          <Component Id="MainExecutable" Guid="BD9D0AE3-A00F-44B6-86AF-6FE5357F16EE">
            <File Id="SetEnvBat" Source="$(var.cs_console.ProjectDir)setenv.bat" KeyPath="yes"/>
            <File Name="vw.exe" Source="$(var.vw.TargetDir)vw.exe"  />
          </Component>

          <Component Id="ApplicationShortCut" Guid="A41E9747-F8A9-47A0-9E8D-C8D7BAB17077">
              <Shortcut Id="ApplicationStartMenuShortcut" Name="Vowpal Wabbit Command Prompt" WorkingDirectory="INSTALLDIR"
                      Directory="ProgramMenuFolder" Target="[System64Folder]CMD.exe"
                        Arguments='/K "[INSTALLDIR]SetEnv.bat"' Show="normal"/>

            <RemoveFolder Id="RemoveVowpalWabbitShortcutDir" Directory="VowpalWabbitShortcutDir" On="both" />
            <RegistryValue Root="HKCU" Key="Software\Microsoft\VowpalWabbit" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
          </Component>

          <Component Id="DotNetExecutable" Guid="82E5FC59-45BE-4A37-8D63-D68E4B6DBC0A">
            <File Source="$(var.cs_console.TargetDir)vw_json.exe" />
            <File Source="$(var.cs_console.TargetDir)Newtonsoft.Json.dll" />
            <File Source="$(var.cs_console.TargetDir)System.Threading.Tasks.Dataflow.dll" />
            <File Source="$(var.cs_console.TargetDir)VowpalWabbit.dll" />
            <File Source="$(var.cs_console.TargetDir)VowpalWabbit.JSON.dll" />
            <File Source="$(var.cs_console.TargetDir)VowpalWabbit.Parallel.dll" />
            <File Source="$(var.cs_console.TargetDir)VowpalWabbit.Common.dll" />
            <File Source="$(var.cs_console.TargetDir)VowpalWabbit.Core.dll" />
          </Component>
        </Directory>
			</Directory>

      <Directory Id="ProgramMenuFolder">
        <Directory Id="VowpalWabbitShortcutDir" Name="Vowpal Wabbit" />
      </Directory>
    </Directory>
	</Fragment>
</Wix>
