<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
  <PropertyGroup>
    <ImplicitUsings>enable</ImplicitUsings>
    <TargetFramework>$(ToolsetTargetFramework)</TargetFramework>
    <StrongNameKeyId>MicrosoftAspNetCore</StrongNameKeyId>
    <OutputType>Exe</OutputType>
    <IsUnitTestProject>true</IsUnitTestProject>
    <Nullable>enable</Nullable>
    <EnableStyleCopAnalyzer>true</EnableStyleCopAnalyzer>
    <GenerateDocumentationFile>true</GenerateDocumentationFile>
  </PropertyGroup>

  <ItemGroup>
    <ProjectReference Include="..\..\src\Cli\dotnet\dotnet.csproj" />
    <ProjectReference Include="..\..\src\Cli\dotnet-new3\dotnet-new3.csproj" />
    <ProjectReference Include="..\Microsoft.NET.TestFramework\Microsoft.NET.TestFramework.csproj" />
    <PackageReference Include="Moq" />
    <PackageReference Include="Verify.Xunit" />
    <PackageReference Include="Verify.DiffPlex" />
    <PackageReference Include="FluentAssertions" />
    <PackageReference Include="Microsoft.TemplateEngine.TestHelper" />
    <PackageReference Include="Microsoft.TemplateEngine.Authoring.TemplateVerifier" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.DotNet.Common.ProjectTemplates.6.0" VersionOverride="6.0.*" GeneratePathProperty="true" />
    <PackageReference Include="Microsoft.DotNet.Common.ProjectTemplates.7.0" VersionOverride="7.0.*-*" GeneratePathProperty="true" />
    <PackageReference Include="Microsoft.DotNet.Common.ProjectTemplates.8.0" VersionOverride="8.0.*-*" GeneratePathProperty="true" />
    <PackageReference Include="Microsoft.DotNet.Web.ProjectTemplates.6.0" VersionOverride="6.0.*" GeneratePathProperty="true" />
    <PackageReference Include="Microsoft.DotNet.Web.ProjectTemplates.7.0" VersionOverride="7.0.*-*" GeneratePathProperty="true" />
    <PackageReference Include="Microsoft.DotNet.Web.ProjectTemplates.8.0" VersionOverride="8.0.*-*" GeneratePathProperty="true" />
  </ItemGroup>

  <PropertyGroup>
    <GeneratedText>
      <![CDATA[
namespace Microsoft.DotNet.Cli.New.IntegrationTests
{
  internal class TemplatePackagesPaths
  {
      public const string MicrosoftDotNetCommonProjectTemplates60Path = @"$(PkgMicrosoft_DotNet_Common_ProjectTemplates_6_0)"%3B
      public const string MicrosoftDotNetCommonProjectTemplates70Path = @"$(PkgMicrosoft_DotNet_Common_ProjectTemplates_7_0)"%3B
      public const string MicrosoftDotNetCommonProjectTemplates80Path = @"$(PkgMicrosoft_DotNet_Common_ProjectTemplates_8_0)"%3B
      public const string MicrosoftDotNetWebProjectTemplates60Path = @"$(PkgMicrosoft_DotNet_Web_ProjectTemplates_6_0)"%3B
      public const string MicrosoftDotNetWebProjectTemplates70Path = @"$(PkgMicrosoft_DotNet_Web_ProjectTemplates_7_0)"%3B
      public const string MicrosoftDotNetWebProjectTemplates80Path = @"$(PkgMicrosoft_DotNet_Web_ProjectTemplates_8_0)"%3B
  }

  internal class TemplatePackageVersion
  {
      public const string MicrosoftTemplateSearchTemplateDiscoveryPackageVersion = "$(MicrosoftTemplateSearchTemplateDiscoveryPackageVersion)"%3B
  }
}
      ]]>
    </GeneratedText>
  </PropertyGroup>

  <Target Name="AddGeneratedFile" BeforeTargets="BeforeCompile;CoreCompile" Inputs="$(MSBuildAllProjects)" Outputs="$(IntermediateOutputPath)GeneratedFile.cs">
    <PropertyGroup>
      <GeneratedFilePath>$(IntermediateOutputPath)TemplatePackagesPaths.cs</GeneratedFilePath>
    </PropertyGroup>
    <ItemGroup>
      <Compile Include="$(GeneratedFilePath)" />
      <FileWrites Include="$(GeneratedFilePath)" />
    </ItemGroup>
    <WriteLinesToFile Lines="$(GeneratedText)" File="$(GeneratedFilePath)" WriteOnlyWhenDifferent="true" Overwrite="true" />
  </Target>

  <Target Name="CopyDBPToArtifactsTmpDir" AfterTargets="Build">
    <Copy SourceFiles="TestDirectoryBuildProps/Directory.Build.props" DestinationFolder="$(ArtifactsTmpDir)" />
  </Target>

  <ItemGroup>
    <Compile Remove="TestTemplates\**\*" />
  </ItemGroup>

  <ItemGroup>
    <Content Include="TestTemplates\**\*" Exclude="TestTemplates\**\bin\**;TestTemplates\**\obj\**" CopyToOutputDirectory="PreserveNewest" />
    <Content Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
  </ItemGroup>

  <ItemGroup>
    <Compile Remove="Approvals\**\*" />
    <None Include="Approvals\**\*" CopyToOutputDirectory="Never" />
  </ItemGroup>
</Project>
