<Project>
  <!-- Check if MSBuildForUnity is being used to resolve, by checking if its version is present or not -->
  <PropertyGroup Condition="'$(MSBuildForUnityVersion)' == ''">
    <!-- If $(UnityPlayer) is not set, default to Standalone. -->
    <MRTKUnityPlayer Condition=" '$(MRTKUnityPlayer)' == '' ">Standalone</MRTKUnityPlayer>

    <!-- Player specific assemblies are in a directory name that starts with the player name and is suffixed with 'Player'. -->
    <_MRTKPlayerDirectory>$(MRTKUnityPlayer)Player</_MRTKPlayerDirectory>
  </PropertyGroup>

   <!-- MSBuild for Unity. -->
   <ItemGroup Condition="'$(MSBuildForUnityVersion)' != ''">
      <Content Include="$(MSBuildThisFileDirectory)..\MRTK\**">
        <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
        <!-- Don't show .meta files in Solution Explorer - it's not useful. -->
        <Visible Condition="'%(Extension)' == '.meta'">false</Visible>
        <Link>$(MSBuildThisFileName)\%(RecursiveDir)%(Filename)%(Extension)</Link>
      </Content>

      <Content Include="$(MSBuildThisFileDirectory)..\Plugins\**">
        <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
        <!-- Don't show .meta files in Solution Explorer - it's not useful. -->
        <Visible Condition="'%(Extension)' == '.meta'">false</Visible>
        <Link>$(MSBuildThisFileName)\Plugins\%(RecursiveDir)%(Filename)%(Extension)</Link>
      </Content>
  </ItemGroup>

   <!-- MRW -->
  <ItemGroup Condition="'$(MSBuildForUnityVersion)' == ''">
    <!-- Include content, but only if explicitly requested. This is useful if an MSBuild project references this
         nuget package, and the output of the MSBuild project is copied into a Unity project. -->
    <Content Include="$(MSBuildThisFileDirectory)..\MRTK\**" Condition=" '$(MRTKIncludeContent)' == 'true' ">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <!-- Don't show .meta files in Solution Explorer - it's not useful. -->
      <Visible Condition=" '%(Extension)' == '.meta' ">false</Visible>
      <Link>MRTK\%(RecursiveDir)%(Filename)%(Extension)</Link>
    </Content>

    <!-- Get all the dlls for the target player, and store the Identity in a custom OriginalPath metadata.
         If Identity is used directly as the HintPath in the Reference, Visual Studio generates a warning
         indicating the assemblies are not found, even though the build succeeds. -->
    <_MRTKPlayerAssemblies Include="$(MSBuildThisFileDirectory)..\Plugins\$(_MRTKPlayerDirectory)\*.dll">
      <OriginalPath>%(Identity)</OriginalPath>
    </_MRTKPlayerAssemblies>

    <!-- Add a Reference to each assembly, where the FileName is assumed to be the assembly name (true by default),
         and the HintPath is just the full path to the assembly.  -->
    <Reference Include="@(_MRTKPlayerAssemblies -> '%(FileName)')">
      <HintPath>%(OriginalPath)</HintPath>
    </Reference>

    <!-- Include assembly meta files, but only if explicitly requested. This is useful if an MSBuild project references this
         nuget package, and the output of the MSBuild project is copied into a Unity project. -->
    <Content Include="@(_MRTKPlayerAssemblies -> '%(OriginalPath).meta')" Condition=" '$(MRTKIncludeAssemblyMetaFiles)' == 'true' ">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <Visible>false</Visible>
    </Content>

    <!-- Clear the _MRTKPlayerAssemblies item list since it will be reused for each MRTK nuget package. -->
    <_MRTKPlayerAssemblies Remove="@(_MRTKPlayerAssemblies)" />
  </ItemGroup>

</Project>
