<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <OutDirName>Tests\$(MSBuildProjectName)</OutDirName>
  </PropertyGroup>

  <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />

  <PropertyGroup>
    <TargetFrameworks>$(ResolverTargetFramework);net472</TargetFrameworks>
    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
    <StrongNameKeyId>MicrosoftAspNetCore</StrongNameKeyId>
    <SignAssembly>true</SignAssembly>
    <PublicSign Condition=" '$([MSBuild]::IsOSPlatform(`Windows`))' == 'false' ">true</PublicSign>
    <IsPackable>true</IsPackable>
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
  </PropertyGroup>

  <ItemGroup>
    <EmbeddedResource Update="**\*.resx" GenerateSource="true" />
  </ItemGroup>

  <Target Name="VerifyMSBuildDependency" BeforeTargets="ResolveAssemblyReferences" Condition="'$([MSBuild]::GetTargetFrameworkIdentifier($(TargetFramework)))' == '.NETCoreApp'">
    <!-- We explicitly reference an older version of MSBuild here to support VS
    for Mac and other VS scenarios. During source-build, we only have access to
    the latest version, which targets NetCurrent. -->
    <PropertyGroup>
      <MSBuildPathInPackage>$(PkgMicrosoft_Build_Runtime)\contentFiles\any\net8.0\MSBuild.dll</MSBuildPathInPackage>
      <MSBuildPathInPackage Condition="'$(DotNetBuildSourceOnly)' == 'true' and !Exists($(MSBuildPathInPackage))">$(PkgMicrosoft_Build_Runtime)\contentFiles\any\$(NetCurrent)\MSBuild.dll</MSBuildPathInPackage>
    </PropertyGroup>
    <Error Condition="!Exists('$(MSBuildPathInPackage)')" Text="Something moved around in Microsoft.Build.Runtime, adjust code here accordingly." />
    <ItemGroup>
      <Reference Include="$(MSBuildPathInPackage)" />
    </ItemGroup>
  </Target>

  <ItemGroup>
    <PackageReference Include="Microsoft.Build.Runtime"
        ExcludeAssets="all"
        Condition="'$([MSBuild]::GetTargetFrameworkIdentifier($(TargetFramework)))' == '.NETCoreApp'"
        GeneratePathProperty="true" />
    <PackageReference Include="Microsoft.Extensions.DependencyModel" />
    <PackageReference Include="NuGet.Versioning" />
    <PackageReference Include="NuGet.Packaging" />
    <!-- nuget moved all type from NuGet.Packaging.Core to NuGet.Packaging and added type forwarding in 5.0.0-rtm.5821.
        However to allow old msbuild tasks like Arcade tasks still function without recompile, NuGet.Packaging.Core need
        to be referenced explicitly so the NuGet.Packaging.Core.dll will be part of the SDK and be available for type forwarding -->
    <PackageReference Include="NuGet.Frameworks" />
    <PackageReference Include="NuGet.ProjectModel" />
    <PackageReference Include="Microsoft.Build" ExcludeAssets="runtime" PrivateAssets="all" />
    <PackageReference Include="Microsoft.Build.Utilities.Core" ExcludeAssets="runtime" PrivateAssets="all" />
    <PackageReference Include="System.CommandLine" />
  </ItemGroup>

  <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project>
