<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->


<Project InitialTargets="PackageRestore" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <PropertyGroup>
    <WixRoot Condition=" '$(WixRoot)'=='' " >$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\))</WixRoot>
    <NugetExe>$(MSBuildThisFileDirectory)bin\NuGet.exe</NugetExe>
    <NugetPackageFolder>$(WixRoot)packages\</NugetPackageFolder>
  </PropertyGroup>

  <PropertyGroup>
    <AzureStorageBuildTasksPath>$(NugetPackageFolder)FireGiant.BuildTasks.AzureStorage.1.0.0.0\tools\</AzureStorageBuildTasksPath>
    <ExtensionPackPath>$(NugetPackageFolder)MSBuild.Extension.Pack.1.2.0\lib\net40\</ExtensionPackPath>
    <LibGit2SharpPath>$(NugetPackageFolder)LibGit2Sharp.0.21.0.176\lib\net40\</LibGit2SharpPath>
    <LibGit2SharpPropsFilePath>$(NugetPackageFolder)LibGit2Sharp.0.21.0.176\build\net40\LibGit2Sharp.props</LibGit2SharpPropsFilePath>
    <SHFBROOT>$(NugetPackageFolder)EWSoftware.SHFB.2014.11.22.0\Tools\</SHFBROOT>
    <XunitPath>$(NugetPackageFolder)xunit.1.9.2\lib\net20\</XunitPath>
  </PropertyGroup>

  <!--
  ================================================================================================
  PackageRestore

    Restores the required packages to build using nuget.exe.
  ================================================================================================
  -->
  <ItemGroup>
    <RestoreNugetPackage Include="EWSoftware.SHFB">
      <Version>2014.11.22.0</Version>
    </RestoreNugetPackage>
    <RestoreNugetPackage Include="FireGiant.BuildTasks.AzureStorage">
      <Version>1.0.0.0</Version>
    </RestoreNugetPackage>
    <RestoreNugetPackage Include="LibGit2Sharp">
      <Version>0.21.0.176</Version>
    </RestoreNugetPackage>
    <RestoreNugetPackage Include="Microsoft.VisualStudio.Setup.Configuration.Native">
      <Version>1.8.24</Version>
    </RestoreNugetPackage>
    <RestoreNugetPackage Include="MSBuild.Extension.Pack">
      <Version>1.2.0</Version>
    </RestoreNugetPackage>
    <RestoreNugetPackage Include="xunit">
      <Version>1.9.2</Version>
    </RestoreNugetPackage>
  </ItemGroup>
  <Target Name="PackageRestore"
          DependsOnTargets="FindMissingPackages">
    <Exec Command="&quot;$(NugetExe)&quot; install %(Identity) -Version %(Version)" Condition=" '@(MissingNugetPackage)'!='' "
          WorkingDirectory="$(MSBuildThisFileDirectory)" />
  </Target>

  <Target Name="FindMissingPackages">
    <CreateItem Include="@(RestoreNugetPackage)" Condition=" !Exists('$(NugetPackageFolder)%(Identity).%(Version)\%(Identity).%(Version).nupkg') " PreserveExistingMetadata="true">
      <Output TaskParameter="Include" ItemName="MissingNugetPackage"/>
    </CreateItem>
  </Target>

  <!-- Sentinel value that indicates Nuget.targets has been initialized. -->
  <PropertyGroup>
    <WixBuildNugetPropertiesDefined>true</WixBuildNugetPropertiesDefined>
  </PropertyGroup>
</Project>
