<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup>
    <PropertyPageSchema
      Include="$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml" />
    <AvailableItemName
      Include="XLF_rule">
      <Targets>_XLF_rule</Targets>
    </AvailableItemName>
  </ItemGroup>
  <UsingTask
    TaskName="XLF_rule"
    TaskFactory="XamlTaskFactory"
    AssemblyName="Microsoft.Build.Tasks.v4.0">
    <Task>$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml</Task>
  </UsingTask>
  <Target
    Name="_XLF_rule"
    BeforeTargets="$(XLF_ruleBeforeTargets)"
    AfterTargets="$(XLF_ruleAfterTargets)"
    Condition="'@(XLF_rule)' != ''"
    DependsOnTargets="$(XLF_ruleDependsOn);ComputeXLF_ruleOutput"
    Outputs="@(XLF_rule-&gt;Metadata('Outputs')-&gt;Distinct())"
    Inputs="@(XLF_rule);%(XLF_rule.AdditionalDependencies);$(MSBuildProjectFile)">
    <ItemGroup
      Condition="'@(SelectedFiles)' != ''">
      <XLF_rule
        Remove="@(XLF_rule)"
        Condition="'%(Identity)' != '@(SelectedFiles)'" />
    </ItemGroup>
    <ItemGroup>
      <XLF_rule_tlog
        Include="%(XLF_rule.Outputs)"
        Condition="'%(XLF_rule.Outputs)' != '' and '%(XLF_rule.ExcludedFromBuild)' != 'true'">
        <Source>@(XLF_rule, '|')</Source>
      </XLF_rule_tlog>
    </ItemGroup>
    <Message
      Importance="High"
      Text="%(XLF_rule.ExecutionDescription)" />
    <WriteLinesToFile
      Condition="'@(XLF_rule_tlog)' != '' and '%(XLF_rule_tlog.ExcludedFromBuild)' != 'true'"
      File="$(IntDir)$(ProjectName).write.1.tlog"
      Lines="^%(XLF_rule_tlog.Source);@(XLF_rule_tlog-&gt;'%(Fullpath)')" />
    <XLF_rule
      Condition="'@(XLF_rule)' != '' and '%(XLF_rule.ExcludedFromBuild)' != 'true'"
      CommandLineTemplate="%(XLF_rule.CommandLineTemplate)"
      AdditionalOptions="%(XLF_rule.AdditionalOptions)"
      Inputs="@(XLF_rule)" />
  </Target>
  <PropertyGroup>
    <ComputeLinkInputsTargets>
            $(ComputeLinkInputsTargets);
            ComputeXLF_ruleOutput;
          </ComputeLinkInputsTargets>
    <ComputeLibInputsTargets>
            $(ComputeLibInputsTargets);
            ComputeXLF_ruleOutput;
          </ComputeLibInputsTargets>
  </PropertyGroup>
  <Target
    Name="ComputeXLF_ruleOutput"
    Condition="'@(XLF_rule)' != ''">
    <ItemGroup>
      <XLF_ruleDirsToMake
        Condition="'@(XLF_rule)' != '' and '%(XLF_rule.ExcludedFromBuild)' != 'true'"
        Include="%(XLF_rule.Outputs)" />
      <Link
        Include="%(XLF_ruleDirsToMake.Identity)"
        Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
      <Lib
        Include="%(XLF_ruleDirsToMake.Identity)"
        Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
      <ImpLib
        Include="%(XLF_ruleDirsToMake.Identity)"
        Condition="'%(Extension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'" />
    </ItemGroup>
    <MakeDir
      Directories="@(XLF_ruleDirsToMake-&gt;'%(RootDir)%(Directory)')" />
  </Target>
</Project>