<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFrameworks>net471;net6.0-windows</TargetFrameworks>
    <LangVersion>latest</LangVersion>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="coverlet.collector" Version="3.1.0">
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.Diagnostics.Runtime" Version="2.0.226801" />
    <PackageReference Include="Microsoft.Diagnostics.Runtime.Utilities" Version="2.0.0-rc.20303.3" />
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.0" />
    <PackageReference Include="xunit" Version="2.4.1" />
    <PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
  </ItemGroup>

  <ItemGroup Condition="'$(TargetFramework)' != 'net6.0-windows'">
    <PackageReference Include="System.Reflection.Metadata" Version="5.0.0" />
    <Reference Include="System.ServiceProcess" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\WinSW\WinSW.csproj" />
    <ProjectReference Include="..\WinSW.Core\WinSW.Core.csproj" />
    <ProjectReference Include="..\WinSW.Plugins\WinSW.Plugins.csproj" />
  </ItemGroup>

  <ItemGroup>
    <Content Include="xunit.runner.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
  </ItemGroup>

  <Target Name="Copy" BeforeTargets="AfterBuild">

    <ItemGroup Condition="'$(TargetFramework)' == 'net6.0-windows'">
      <_FilesToCopy Include="$(ArtifactsBinDir)WinSW\$(Configuration)\net6.0-windows\WinSW.runtimeconfig*.json" />
    </ItemGroup>

    <ItemGroup Condition="'$(TargetFramework)' != 'net6.0-windows'">
      <_FilesToCopy Include="$(ArtifactsBinDir)WinSW\$(Configuration)\net461\System.ValueTuple.dll" />
    </ItemGroup>

    <Copy SourceFiles="@(_FilesToCopy)" DestinationFolder="$(OutputPath)" />

  </Target>

</Project>
