<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="FulLBuild">

  <!-- 
    msbuild.exe build.proj
  -->

  <PropertyGroup>
    <SourceRoot Condition=" '$(SourceRoot)'=='' ">$(MSBuildProjectDirectory)\</SourceRoot>
    <OutputRootNoTrailingSlash Condition=" '$(OutputRoot)'=='' ">$(SourceRoot)OutputRoot</OutputRootNoTrailingSlash>
    <OutputRoot Condition=" '$(OutputRoot)'=='' ">$(OutputRootNoTrailingSlash)\</OutputRoot>
    <DevFolder Condition=" '$(DevFolder)'=='' ">c:\temp\msbuild\</DevFolder>
    <RestorePackages Condition=" '$(RestorePackages)'=='' ">true</RestorePackages>
    <VisualStudioVersion Condition=" '$(VisualStudioVersion)'=='' ">11.0</VisualStudioVersion>
  </PropertyGroup>

  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)'=='' ">Release</Configuration>
  </PropertyGroup>
  
  <ItemGroup>
    <!--<ToolsItems Include="$(SourceRoot)Tools\**\*" />-->

    <ContentItems Include="$(SourceRoot)content\**\*">
      <DestDir>%(RecursiveDir)</DestDir>
    </ContentItems>

    <ProjectsToBuild Include="$(SourceRoot)TemplatePack\TemplatePack.csproj" />
  </ItemGroup>

  <PropertyGroup>
    <FullBuildDependsOn>
      CoreFullBuild;
    </FullBuildDependsOn>
  </PropertyGroup>

  <Target Name="FullBuild" DependsOnTargets="$(FullBuildDependsOn)"/>
  <Target Name="CoreFullBuild">
    <PropertyGroup>
      <_MSBProperties>VisualStudioVersion=$(VisualStudioVersion);Configuration=$(Configuration);OutputPath=$(OutputRoot);RestorePackages=$(RestorePackages)</_MSBProperties>
      <_MSBProperties Condition=" '$(TemplateBuilderTargets)'!='' ">$(_MSBProperties);TemplateBuilderTargets=$(TemplateBuilderTargets)</_MSBProperties>
    </PropertyGroup>
    
    <MSBuild Projects="@(ProjectsToBuild)" 
             Properties="$(_MSBProperties)"/>
  </Target>
  
  <Target Name="CleanAndInitalize">
    <MakeDir Directories="$(OutputRoot)"/>
    <MakeDir Directories="$(PackageRoot)"/>
    
    <ItemGroup>
      <_FilesToDelete Remove="@(_FilesToDelete)"/>
      <_FilesToDelete Include="$(OutputRoot)**\*"/>
    </ItemGroup>
    <Delete Files="@(_FilesToDelete)"/>

    <ItemGroup>
      <_FilesToDelete Remove="@(_FilesToDelete)"/>
      <_FilesToDelete Include="$(PackageRoot)**\*"/>
    </ItemGroup>
    <Delete Files="@(_FilesToDelete)"/>
  </Target>
</Project>
