<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <!-- Load version information from the central versions file, creating -PRERELEASE if needed -->
  <Import Project="$(SolutionDir)versions.target" />
  <PropertyGroup Condition="'$(Release)' != 'true' ">
    <PreReleaseDecoration>-PRERELEASE</PreReleaseDecoration>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Release)' == 'true' ">
    <PreReleaseDecoration>
    </PreReleaseDecoration>
  </PropertyGroup>
  <!-- Set up VS minimal configuation -->
  <ItemGroup Label="ProjectConfigurations">
    <ProjectConfiguration Include="Debug|x64">
      <Configuration>Debug</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|x64">
      <Configuration>Release</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
  </ItemGroup>
  <PropertyGroup Label="Globals">
    <ProjectGuid>{9463CB25-DCA0-9D45-C46E-0A8E68EE7FAE}</ProjectGuid>
    <Keyword>Win32Proj</Keyword>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
  <PropertyGroup Label="Configuration">
    <PlatformToolset>v140_xp</PlatformToolset>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
  <PropertyGroup>
    <IntDir>$(SystemDrive)\temp\msvcfdb\$(Platform)$(Configuration)\$(MSBuildProjectName)\</IntDir>
  </PropertyGroup>
  <!-- Meat of the work to create proper node output. -->
  <ItemDefinitionGroup>
    <!-- Clean up before a build -->
    <PreBuildEvent>
      <Command>del "$(SolutionDir)bin\$(Configuration)\fdb-node*.tar.gz"</Command>
    </PreBuildEvent>
    <PostBuildEvent>
      <!-- After build, create package.json from input -->
      <Command>
c:\python27\python -c "print open(\"package.json.in\").read().replace(\"VERSION\",\"$(Version)$(PreReleaseDecoration)\")" &gt; package.json
copy ..\..\LICENSE
c:\python27\python "$(SolutionDir)build/tarball.py" -r nodejs "$(SolutionDir)bin\$(Configuration)\fdb-node-$(Version)$(PreReleaseDecoration)-windows-$(Platform).tar.gz" lib modules package.json README.md LICENSE
del LICENSE</Command>
    </PostBuildEvent>
  </ItemDefinitionGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
  <Target Name="AfterClean">
    <!-- Add output of which VS was not aware to "clean" step -->
    <ItemGroup>
      <FilesToDelete Include="$(ProjectDir)package.json">
        <Visible>false</Visible>
      </FilesToDelete>
      <FilesToDelete Include="$(SolutionDir)bin\$(Configuration)\fdb-node-$(Version)$(PreReleaseDecoration)-windows-$(Platform).tar.gz">
        <Visible>false</Visible>
      </FilesToDelete>
    </ItemGroup>
    <Message Text="Cleaning package.json and tar.gz file" Importance="high" />
    <Delete Files="@(FilesToDelete)" />
  </Target>
</Project>