<Project>

  <PropertyGroup>
    <PublishRoot Condition="'$(PublishRoot)' == ''">$(RepoRoot)\src\WebSdk\Publish\</PublishRoot>
    <PackageId>Microsoft.NET.Sdk.Publish</PackageId>
    <OutDirName>$(Configuration)\Sdks\$(PackageId)\tools</OutDirName>
  </PropertyGroup>

  <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
  <Import Project="$(RepoRoot)\src\WebSdk\Package.props" />
  
  <PropertyGroup>
    <TargetFrameworks>$(SdkTargetFramework);net472</TargetFrameworks>
    <PlatformTarget>AnyCPU</PlatformTarget>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.Build" ExcludeAssets="Runtime" />
    <PackageReference Include="Microsoft.Build.Framework" ExcludeAssets="Runtime" />
    <PackageReference Include="Microsoft.Build.Utilities.Core" ExcludeAssets="Runtime" />
    <PackageReference Include="System.Security.Cryptography.ProtectedData" />
    <PackageReference Include="Microsoft.Web.Xdt" />
  </ItemGroup>

  <ItemGroup Condition="'$(TargetFramework)' == '$(SdkTargetFramework)'">
    <PackageReference Include="System.Collections.Specialized" ExcludeAssets="Runtime"/>
    <PackageReference Include="System.Xml.XmlDocument" ExcludeAssets="Runtime" />
  </ItemGroup>

  <ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
    <Reference Include="System" />
    <Reference Include="System.IO.Compression.FileSystem" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Data" />
    <Reference Include="System.Net.Http" />
    <Reference Include="System.Xml" />
    <PackageReference Include="Microsoft.Web.Deployment" />
    <PackageReference Include="System.Text.Json" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="**\*.cs" />

    <Compile Update="Properties\Resources.Designer.cs">
      <DesignTime>True</DesignTime>
      <AutoGen>True</AutoGen>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>

    <Compile Include="$(RepoRoot)src\Common\EnvironmentVariableNames.cs" LinkBase="Common"/>
    <Compile Include="$(RepoRoot)src\Common\CompileOptions.cs" LinkBase="Common"/>

    <AdditionalContent Include="$(PublishRoot)\Targets\**\*.*">
      <Pack>true</Pack>
      <PackagePath>targets</PackagePath>
    </AdditionalContent>

    <AdditionalContent Include="$(PublishRoot)\Sdk\**\*.*">
      <Pack>true</Pack>
      <PackagePath>Sdk</PackagePath>
    </AdditionalContent>

    <EmbeddedResource Include="Properties\Resources.resx">
      <Generator>PublicResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
    </EmbeddedResource>
  </ItemGroup>

  <!-- Global usings -->
  <!-- See: https://learn.microsoft.com/dotnet/core/project-sdk/msbuild-props#using -->
  <ItemGroup>
    <!-- This causes conflicts with System.Threading.Tasks.Task. Giving it an alias to avoid the conflict. -->
    <Using Include="Microsoft.Build.Utilities.Task" Alias="Task" />
  </ItemGroup>

  <Import Project="$(RepoRoot)\src\WebSdk\CopyPackageLayout.targets" />
  <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />

</Project>
