<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)..\</SolutionDir>
  </PropertyGroup>
  <PropertyGroup>
    <GitVersionAssemblyVersioningScheme Condition="$(GitVersionAssemblyVersioningScheme) == '' Or $(GitVersionAssemblyVersioningScheme) == '*Undefined*'"></GitVersionAssemblyVersioningScheme>
  </PropertyGroup>

  <UsingTask
      TaskName="GitVersionTask.UpdateAssemblyInfo"
      AssemblyFile="$(MSBuildThisFileDirectory)..\GitVersionTask.dll" />
  <UsingTask 
    TaskName="GitVersionTask.GetVersion" 
    AssemblyFile="$(MSBuildThisFileDirectory)..\GitVersionTask.dll"  />
  <UsingTask
      TaskName="GitVersionTask.WriteVersionInfoToBuildLog"
      AssemblyFile="$(MSBuildThisFileDirectory)..\GitVersionTask.dll" />

  <Target Name="UpdateAssemblyInfo"
          BeforeTargets="CoreCompile">
    <WriteVersionInfoToBuildLog
      SolutionDirectory="$(SolutionDir)"
        />
    <UpdateAssemblyInfo
      SolutionDirectory="$(SolutionDir)"
      ProjectFile="$(ProjectPath)"
      ProjectDir="$(ProjectDir)"
      Configuration="$(ConfigurationName)"
      AssemblyVersioningScheme="$(GitVersionAssemblyVersioningScheme)"
      CompileFiles ="@(Compile)">
      <Output
        TaskParameter="AssemblyInfoTempFilePath"
        PropertyName="AssemblyInfoTempFilePath" />
    </UpdateAssemblyInfo>

    <ItemGroup>
      <Compile Include="$(AssemblyInfoTempFilePath)" />
    </ItemGroup>


    <GetVersion SolutionDirectory="$(SolutionDir)">
      <Output TaskParameter="Major" PropertyName="GfvMajor" />
      <Output TaskParameter="Minor" PropertyName="GfvMinor" />
      <Output TaskParameter="Patch" PropertyName="GfvPatch" />
      <Output TaskParameter="BuildMetaData" PropertyName="GfvBuildMetaData" />
      <Output TaskParameter="FullBuildMetaData" PropertyName="GfvFullBuildMetaData" />
      <Output TaskParameter="BranchName" PropertyName="GfvBranchName" />
      <Output TaskParameter="Sha" PropertyName="GfvSha" />
      <Output TaskParameter="MajorMinorPatch" PropertyName="GfvMajorMinorPatch" />
      <Output TaskParameter="SemVer" PropertyName="GfvSemVer" />
      <Output TaskParameter="LegacySemVer" PropertyName="GfvLegacySemVer" />
      <Output TaskParameter="LegacySemVerPadded" PropertyName="GfvLegacySemVerPadded" />
      <Output TaskParameter="FullSemVer" PropertyName="GfvFullSemVer" />
      <Output TaskParameter="AssemblySemVer" PropertyName="GfvAssemblySemVer" />
      <Output TaskParameter="NuGetVersion" PropertyName="GfvNuGetVersion" />
      <Output TaskParameter="ClassicVersion" PropertyName="GfvClassicVersion" />
      <Output TaskParameter="ClassicVersionWithTag" PropertyName="GfvClassicVersionWithTag" />
      <Output TaskParameter="PreReleaseTag" PropertyName="GfvPreReleaseTag" />
      <Output TaskParameter="PreReleaseTagWithDash" PropertyName="GfvPreReleaseTagWithDash" />
      <Output TaskParameter="InformationalVersion" PropertyName="GfvInformationalVersion" />
    </GetVersion>

  </Target>

  <!--Support for ncrunch-->
  <ItemGroup>
    <None Include="$(MSBuildThisFileDirectory)..\GitVersionTask.dll" />
    <None Include="$(MSBuildThisFileDirectory)..\GitVersionTask.pdb" />
    <None Include="$(MSBuildThisFileDirectory)..\NativeBinaries\**\*" />
  </ItemGroup>

</Project>


