<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup>
    <PropertyPageSchema
      Include="$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml" />
    <AvailableItemName
      Include="Bison">
      <Targets>BisonTarget</Targets>
    </AvailableItemName>
  </ItemGroup>
  <UsingTask
    TaskName="Bison"
    TaskFactory="XamlTaskFactory"
    AssemblyName="Microsoft.Build.Tasks.v4.0">
    <Task>$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml</Task>
  </UsingTask>
  <Target
    Name="BisonTarget"
    BeforeTargets="$(BisonBeforeTargets)"
    AfterTargets="$(BisonAfterTargets)"
    Condition="'@(Bison)' != ''"
    DependsOnTargets="$(BisonDependsOn);ComputeBisonOutput"
    Outputs="%(Bison.Outputs)"
    Inputs="%(Bison.Identity);%(Bison.AdditionalDependencies);$(MSBuildProjectFile)">
    <ItemGroup
      Condition="'@(SelectedFiles)' != ''">
      <Bison
        Remove="@(Bison)"
        Condition="'%(Identity)' != '@(SelectedFiles)'" />
    </ItemGroup>
    <ItemGroup>
      <Bison_tlog
        Include="%(Bison.Outputs)"
        Condition="'%(Bison.Outputs)' != '' and '%(Bison.ExcludedFromBuild)' != 'true'">
        <Source>@(Bison, '|')</Source>
      </Bison_tlog>
    </ItemGroup>
    <Message
      Importance="High"
      Text="%(Bison.ExecutionDescription)" />
    <WriteLinesToFile
      Condition="'@(Bison_tlog)' != '' and '%(Bison_tlog.ExcludedFromBuild)' != 'true'"
      File="$(IntDir)$(ProjectName).write.1.tlog"
      Lines="^%(Bison_tlog.Source);@(Bison_tlog-&gt;'%(Fullpath)')" />
    <Bison
      Condition="'@(Bison)' != '' and '%(Bison.ExcludedFromBuild)' != 'true'"
      CommandLineTemplate="%(Bison.CommandLineTemplate)"
      OutputFile="%(Bison.OutputFile)"
      DefinesFile="%(Bison.DefinesFile)"
      Debug="%(Bison.Debug)"
      Verbose="%(Bison.Verbose)"
      NoLines="%(Bison.NoLines)"
      FilePrefix="%(Bison.FilePrefix)"
      GraphFile="%(Bison.GraphFile)"
      Warnings="%(Bison.Warnings)"
      Report="%(Bison.Report)"
      ReportFile="%(Bison.ReportFile)"
      AdditionalOptions="%(Bison.AdditionalOptions)"
      Inputs="%(Bison.Identity)" />
  </Target>
  <PropertyGroup>
    <ComputeLinkInputsTargets>
            $(ComputeLinkInputsTargets);
            ComputeBisonOutput;
          </ComputeLinkInputsTargets>
    <ComputeLibInputsTargets>
            $(ComputeLibInputsTargets);
            ComputeBisonOutput;
          </ComputeLibInputsTargets>
  </PropertyGroup>
  <Target
    Name="ComputeBisonOutput"
    Condition="'@(Bison)' != ''">
    <ItemGroup>
      <BisonDirsToMake
        Condition="'@(Bison)' != '' and '%(Bison.ExcludedFromBuild)' != 'true'"
        Include="%(Bison.Outputs)" />
      <Link
        Include="%(BisonDirsToMake.Identity)"
        Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
      <Lib
        Include="%(BisonDirsToMake.Identity)"
        Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
      <ImpLib
        Include="%(BisonDirsToMake.Identity)"
        Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
    </ItemGroup>
    <MakeDir
      Directories="@(BisonDirsToMake-&gt;'%(RootDir)%(Directory)')" />
  </Target>
</Project>