<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
    <ProductVersion>3.10</ProductVersion>
    <ProjectGuid>418432ab-0366-40fd-a396-8cc0c4200252</ProjectGuid>
    <SchemaVersion>2.0</SchemaVersion>
    <OutputName>Keybase_%25KEYBASE_VERSION%25.%25GOARCH%25</OutputName>
    <OutputType>Bundle</OutputType>
    <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' AND '$(MSBuildExtensionsPath32)' != '' ">$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
    <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
    <Name>KeybaseBundle</Name>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
    <OutputPath>bin\$(Configuration)\</OutputPath>
    <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
    <DefineConstants>Debug</DefineConstants>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
    <OutputPath>bin\$(Configuration)\</OutputPath>
    <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
  </PropertyGroup>
  <ItemGroup>
    <Compile Include="Bundle.wxs" />
  </ItemGroup>
  <ItemGroup>
    <WixExtension Include="WixNetFxExtension">
      <HintPath>$(WixExtDir)\WixNetFxExtension.dll</HintPath>
      <Name>WixNetFxExtension</Name>
    </WixExtension>
    <WixExtension Include="WixUtilExtension">
      <HintPath>$(WixExtDir)\WixUtilExtension.dll</HintPath>
      <Name>WixUtilExtension</Name>
    </WixExtension>
    <WixExtension Include="WixBalExtension">
      <HintPath>$(WixExtDir)\WixBalExtension.dll</HintPath>
      <Name>WixBalExtension</Name>
    </WixExtension>
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\KeybaseApps\KeybaseApps.wixproj">
      <Name>KeybaseApps</Name>
      <Project>{cb18799f-a8c7-4571-b80f-6c00a0cd88fd}</Project>
      <Private>True</Private>
      <DoNotHarvest>True</DoNotHarvest>
      <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
      <RefTargetDir>INSTALLFOLDER</RefTargetDir>
    </ProjectReference>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="HyperlinkTheme.wxl" />
  </ItemGroup>
  <ItemGroup>
    <Content Include="HyperlinkTheme.xml" />
  </ItemGroup>
  <Import Project="$(WixTargetsPath)" />
  <PropertyGroup>
    <PreBuildEvent>cd /d "$(ProjectDir)"

if NOT exist Redist\VCRedist_2015\vc_redist.x86.exe (

    if NOT exist Redist\ mkdir Redist

    if NOT exist Redist\VCRedist_2015\ mkdir Redist\VCRedist_2015\

    powershell -command "wget https://download.microsoft.com/download/2/6/8/268f7be7-8d2a-42d6-a823-5c6941a3d70a/vc_redist.x86.exe -OutFile Redist\VCRedist_2015\VC_redist.x86.exe"

    powershell -command "wget https://download.microsoft.com/download/6/3/a/63abaf83-2ca6-4460-90d7-12de8e815b1a/vc_redist.x64.exe -OutFile Redist\VCRedist_2015\VC_redist.x64.exe"

)

if NOT exist Redist\KB2999226\Windows8.1-KB2999226-x64.msu (
    if NOT exist Redist\ mkdir Redist
    if NOT exist Redist\KB2999226\ mkdir Redist\KB2999226\
    powershell -command "wget https://download.microsoft.com/download/4/F/E/4FE73868-5EDD-4B47-8B33-CE1BB7B2B16A/Windows6.1-KB2999226-x86.msu -OutFile Redist\KB2999226\Windows6.1-KB2999226-x86.msu"
    powershell -command "wget https://download.microsoft.com/download/1/1/5/11565A9A-EA09-4F0A-A57E-520D5D138140/Windows6.1-KB2999226-x64.msu -OutFile Redist\KB2999226\Windows6.1-KB2999226-x64.msu"
    powershell -command "wget https://download.microsoft.com/download/1/E/8/1E8AFE90-5217-464D-9292-7D0B95A56CE4/Windows8-RT-KB2999226-x86.msu -OutFile Redist\KB2999226\Windows8-RT-KB2999226-x86.msu"
    powershell -command "wget https://download.microsoft.com/download/A/C/1/AC15393F-A6E6-469B-B222-C44B3BB6ECCC/Windows8-RT-KB2999226-x64.msu -OutFile Redist\KB2999226\Windows8-RT-KB2999226-x64.msu"
    powershell -command "wget https://download.microsoft.com/download/E/4/6/E4694323-8290-4A08-82DB-81F2EB9452C2/Windows8.1-KB2999226-x86.msu -OutFile Redist\KB2999226\Windows8.1-KB2999226-x86.msu"
    powershell -command "wget https://download.microsoft.com/download/9/6/F/96FD0525-3DDF-423D-8845-5F92F4A6883E/Windows8.1-KB2999226-x64.msu -OutFile Redist\KB2999226\Windows8.1-KB2999226-x64.msu"
)</PreBuildEvent>
  </PropertyGroup>
  <PropertyGroup>
    <PostBuildEvent>if /I "$(ConfigurationName)" == "Release" (
  "%25WIX%25\bin\insignia.exe" -ib "$(TargetDir)$(TargetFileName)" -o "$(TargetDir)engine.exe"
  "%25SIGNTOOL%25" sign /a /v /t http://timestamp.digicert.com /i "%25CERTISSUER%25" "$(TargetDir)engine.exe"
  "%25SIGNTOOL%25" sign /a /as /v /fd SHA256 /tr http://timestamp.digicert.com /td SHA256 /i "%25CERTISSUER%25" "$(TargetDir)engine.exe"
  "%25WIX%25\bin\insignia.exe" -ab "$(TargetDir)engine.exe" "$(TargetDir)$(TargetFileName)" -o "$(TargetDir)$(TargetFileName)"
  "%25SIGNTOOL%25" sign /a /v /t http://timestamp.digicert.com /i "%25CERTISSUER%25" "$(TargetDir)$(TargetFileName)"
  "%25SIGNTOOL%25" sign /a /as /v /fd SHA256 /tr http://timestamp.digicert.com /td SHA256 /i "%25CERTISSUER%25"  "$(TargetDir)$(TargetFileName)"
  del "$(TargetDir)engine.exe"
)</PostBuildEvent>
  </PropertyGroup>
  <!--
	To modify your build process, add your task inside one of the targets below and uncomment it.
	Other similar extension points exist, see Wix.targets.
	<Target Name="BeforeBuild">
	</Target>
	<Target Name="AfterBuild">
	</Target>
	-->
</Project>