<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="Current">
    <PropertyGroup>
        <RootNamespace>Server</RootNamespace>
        <AssemblyName>UOContent</AssemblyName>
        <Product>ModernUO Content</Product>
        <PublishDir>..\..\Distribution\Assemblies</PublishDir>
        <OutDir>..\..\Distribution\Assemblies</OutDir>
    </PropertyGroup>
    <Target Name="CleanPub" AfterTargets="Clean">
        <Message Text="Deleting source generated files..." />
        <Delete Files="Generated\**" ContinueOnError="true" />
        <Message Text="Removing distribution assemblies..." />
        <Delete Files="..\..\Distribution\Assemblies\Argon2.Bindings.dll" ContinueOnError="true" />
        <Delete Files="..\..\Distribution\Assemblies\BouncyCastle.Crypto.dll" ContinueOnError="true" />
        <Delete Files="..\..\Distribution\Assemblies\MailKit.dll" ContinueOnError="true" />
        <Delete Files="..\..\Distribution\Assemblies\MimeKit.dll" ContinueOnError="true" />
        <Delete Files="..\..\Distribution\Assemblies\Microsoft.Toolkit.HighPerformance.dll" ContinueOnError="true" />
        <Delete Files="..\..\Distribution\Assemblies\System.Security.Cryptography.Pkcs.dll" ContinueOnError="true" />
        <Delete Files="..\..\Distribution\Assemblies\$(AssemblyName).dll" ContinueOnError="true" />
        <Delete Files="..\..\Distribution\Assemblies\ref\$(AssemblyName).dll" ContinueOnError="true" />
        <Delete Files="..\..\Distribution\Assemblies\$(AssemblyName).deps.json" ContinueOnError="true" />
        <Delete Files="..\..\Distribution\Assemblies\$(AssemblyName).pdb" ContinueOnError="true" />
        <Delete Files="..\..\Distribution\Assemblies\libargon2.dll" ContinueOnError="true" />
        <Delete Files="..\..\Distribution\Assemblies\libargon2.dylib" ContinueOnError="true" />
        <Delete Files="..\..\Distribution\Assemblies\libargon2.so" ContinueOnError="true" />
        <Delete Files="..\..\Distribution\Assemblies\zlib.dll" ContinueOnError="true" />
        <Delete Files="..\..\Distribution\Assemblies\libz.dylib" ContinueOnError="true" />
        <Delete Files="..\..\Distribution\Assemblies\libz.so" ContinueOnError="true" />
        <Delete Files="..\..\Distribution\Assemblies\ZLib.Bindings.dll" ContinueOnError="true" />
        <Delete Files="Generated\**\*" ContinueOnError="true" />
        <RemoveDir Directories="Generated" ContinueOnError="true" />
    </Target>
    <ItemGroup>
        <ProjectReference Include="..\Server\Server.csproj" Private="false" PrivateAssets="All" IncludeAssets="None">
            <IncludeInPackage>false</IncludeInPackage>
        </ProjectReference>
        <PackageReference Include="MailKit" Version="2.14.0" />
        <PackageReference Include="Microsoft.Toolkit.HighPerformance" Version="7.0.2" />
        <PackageReference Include="Zlib.Bindings" Version="1.5.0" />
        <PackageReference Include="Argon2.Bindings" Version="1.9.1" />
    </ItemGroup>
    <ItemGroup>
        <ProjectReference Include="..\SerializationGenerator\SerializationGenerator.csproj">
            <SetTargetFramework>TargetFramework=netstandard2.0</SetTargetFramework>
            <OutputItemType>Analyzer</OutputItemType>
            <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
            <PrivateAssets>all</PrivateAssets>
        </ProjectReference>
    </ItemGroup>
    <ItemGroup>
        <AdditionalFiles Include="Migrations/*.v*.json" />
    </ItemGroup>
    <PropertyGroup Condition="'$(RiderVersion)' != '' AND $([MSBuild]::VersionLessThan($(RiderVersion), '2021.2.0'))">
        <EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
        <CompilerGeneratedFilesOutputPath>Generated</CompilerGeneratedFilesOutputPath>
    </PropertyGroup>
    <Target Name="RemoveSourceGeneratedFiles" BeforeTargets="CoreCompile" Condition="'$(RiderVersion)' != '' AND $([MSBuild]::VersionLessThan($(RiderVersion), '2021.2.0'))">
        <ItemGroup>
            <Compile Remove="Generated\**" />
        </ItemGroup>
    </Target>
    <Target Name="AddSourceGeneratedFiles" AfterTargets="CoreCompile" Condition="'$(RiderVersion)' != '' AND $([MSBuild]::VersionLessThan($(RiderVersion), '2021.2.0'))">
        <ItemGroup>
            <Compile Include="Generated\**" />
        </ItemGroup>
    </Target>
</Project>
