<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <Description>Lightweight Http Mocking Server for .Net, inspired by WireMock from the Java landscape.</Description>
        <AssemblyTitle>WireMock.Net</AssemblyTitle>
        <Authors>Stef Heyenrath</Authors>
        <TargetFrameworks>net451;net452;net46;net461;netstandard1.3;netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
        <GenerateDocumentationFile>true</GenerateDocumentationFile>
        <AssemblyName>WireMock.Net</AssemblyName>
        <PackageId>WireMock.Net</PackageId>
        <PackageTags>tdd;mock;http;wiremock;test;server;unittest</PackageTags>
        <RootNamespace>WireMock</RootNamespace>
        <ProjectGuid>{D3804228-91F4-4502-9595-39584E5A01AD}</ProjectGuid>
        <PublishRepositoryUrl>true</PublishRepositoryUrl>
        <AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
        <EmbedUntrackedSources>true</EmbedUntrackedSources>
        <!--<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
    <GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>-->
        <SignAssembly>true</SignAssembly>
        <AssemblyOriginatorKeyFile>WireMock.Net.snk</AssemblyOriginatorKeyFile>
        <!--<DelaySign>true</DelaySign>-->
        <PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
    </PropertyGroup>

    <!-- https://github.com/aspnet/RoslynCodeDomProvider/issues/51 -->
    <!-- This is needed else we cannot build net452 in Azure DevOps Pipeline -->
    <!--<Target Name="CheckIfShouldKillVBCSCompiler" />-->

    <PropertyGroup Condition="'$(Configuration)' == 'Release'">
        <!--<PathMap>$(MSBuildProjectDirectory)=/</PathMap>-->
        <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
    </PropertyGroup>

    <PropertyGroup Condition="'$(Configuration)' == 'Debug - Sonar'">
        <CodeAnalysisRuleSet>WireMock.Net.ruleset</CodeAnalysisRuleSet>
    </PropertyGroup>

    <PropertyGroup Condition="'$(TargetFramework)' == 'netstandard1.3' or '$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'netstandard2.1'">
        <DefineConstants>$(DefineConstants);NETSTANDARD;USE_ASPNETCORE</DefineConstants>
    </PropertyGroup>

    <PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1' or '$(TargetFramework)' == 'netcoreapp2.2' or '$(TargetFramework)' == 'netcoreapp3.1' or '$(TargetFramework)' == 'net5.0' or '$(TargetFramework)' == 'net6.0' or '$(TargetFramework)' == 'net7.0' or '$(TargetFramework)' == 'net8.0'">
        <DefineConstants>$(DefineConstants);USE_ASPNETCORE</DefineConstants>
    </PropertyGroup>

    <PropertyGroup Condition="'$(TargetFramework)' == 'net461'">
        <DefineConstants>$(DefineConstants);USE_ASPNETCORE;NET46</DefineConstants>
    </PropertyGroup>

    <PropertyGroup Condition="'$(TargetFramework)' != 'netstandard1.3' and '$(TargetFramework)' != 'net451' and '$(TargetFramework)' != 'net452'">
        <DefineConstants>$(DefineConstants);OPENAPIPARSER</DefineConstants>
    </PropertyGroup>

    <PropertyGroup Condition="'$(TargetFramework)' != 'netstandard1.3' and '$(TargetFramework)' != 'net451' and '$(TargetFramework)' != 'net452' and '$(TargetFramework)' != 'net46' and '$(TargetFramework)' != 'net461'">
        <DefineConstants>$(DefineConstants);GRAPHQL;MIMEKIT;PROTOBUF</DefineConstants>
    </PropertyGroup>

    <PropertyGroup Condition="'$(TargetFramework)' != 'netstandard1.3' and '$(TargetFramework)' != 'net451' and '$(TargetFramework)' != 'net452' and '$(TargetFramework)' != 'net46' ">
        <DefineConstants>$(DefineConstants);TRAILINGHEADERS</DefineConstants>
    </PropertyGroup>

    <ItemGroup>
      <Compile Remove="Json\DynamicPropertyWithValue.cs" />
      <Compile Remove="Json\JObjectExtensions.cs" />
      <Compile Remove="Matchers\LinqMatcher.cs" />
    </ItemGroup>

    <ItemGroup>
        <PackageReference Include="JsonConverter.Abstractions" Version="0.7.0" />
        <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
        <PackageReference Include="NJsonSchema.Extensions" Version="0.1.0" />
        <PackageReference Include="NSwag.Core" Version="13.16.1" />
        <PackageReference Include="SimMetrics.Net" Version="1.0.5" />
        <PackageReference Include="JmesPath.Net" Version="1.0.330" />
        <PackageReference Include="AnyOf" Version="0.4.0" />
        <PackageReference Include="TinyMapper" Version="3.0.3" />
    </ItemGroup>

    <ItemGroup Condition=" '$(TargetFramework)' != 'netstandard1.3' ">
        <PackageReference Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" Version="6.34.0" />
    </ItemGroup>

    <ItemGroup Condition=" '$(TargetFramework)' == 'net451' or '$(TargetFramework)' == 'net452' ">
        <!-- Required for WebRequestHandler -->
        <Reference Include="System.Net.Http.WebRequest" />

        <PackageReference Include="Microsoft.AspNet.WebApi.OwinSelfHost" Version="5.2.6" />
        <PackageReference Include="System.ValueTuple" Version="4.5.0" />
        <PackageReference Include="Scriban.Signed" Version="2.1.4" />
        <PackageReference Include="Nullable" Version="1.3.1">
            <PrivateAssets>all</PrivateAssets>
            <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
        </PackageReference>
    </ItemGroup>

    <ItemGroup Condition=" '$(TargetFramework)' == 'net46' ">
        <PackageReference Include="Microsoft.AspNet.WebApi.OwinSelfHost" Version="5.2.6" />
        <PackageReference Include="Microsoft.Owin" Version="4.2.2" />
        <PackageReference Include="Microsoft.Owin.Host.HttpListener" Version="4.0.0" />
        <PackageReference Include="Microsoft.Owin.Hosting" Version="4.0.0" />
        <PackageReference Include="System.Net.Http" Version="4.3.4" />
        <PackageReference Include="System.ValueTuple" Version="4.5.0" />
        <PackageReference Include="Scriban.Signed" Version="2.1.4" />
        <PackageReference Include="Nullable" Version="1.3.1">
            <PrivateAssets>all</PrivateAssets>
            <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
        </PackageReference>
    </ItemGroup>

    <ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">
        <PackageReference Include="Scriban.Signed" Version="2.1.4" />
        <PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
        <PackageReference Include="Nullable" Version="1.3.1">
            <PrivateAssets>all</PrivateAssets>
            <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
        </PackageReference>

        <!-- https://github.com/WireMock-Net/WireMock.Net/issues/507 -->
        <PackageReference Include="Microsoft.AspNetCore.Server.IIS" Version="2.2.6" />
    </ItemGroup>

    <ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.3' ">
        <PackageReference Include="System.Collections.Specialized" Version="4.3.0" />
        <PackageReference Include="Microsoft.AspNetCore" Version="1.1.7" />
        <PackageReference Include="Microsoft.AspNetCore.Server.Kestrel.Https" Version="1.1.3" />
        <PackageReference Include="System.Xml.XmlDocument" Version="4.3.0" />
        <PackageReference Include="System.Xml.XPath.XmlDocument" Version="4.3.0" />
        <PackageReference Include="System.ValueTuple" Version="4.5.0" />
        <PackageReference Include="Scriban.Signed" Version="2.1.4" />
        <PackageReference Include="Nullable" Version="1.3.1">
            <PrivateAssets>all</PrivateAssets>
            <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
        </PackageReference>
    </ItemGroup>

    <ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'netstandard2.1' ">
        <PackageReference Include="Scriban.Signed" Version="5.5.0" />
        <PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
        <PackageReference Include="Nullable" Version="1.3.1">
            <PrivateAssets>all</PrivateAssets>
            <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
        </PackageReference>

        <!-- https://github.com/WireMock-Net/WireMock.Net/issues/507 -->
        <PackageReference Include="Microsoft.AspNetCore.Server.IIS" Version="2.2.6" />
    </ItemGroup>

    <ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1' or '$(TargetFramework)' == 'net5.0' or '$(TargetFramework)' == 'net6.0' or '$(TargetFramework)' == 'net7.0' or '$(TargetFramework)' == 'net8.0'">
        <FrameworkReference Include="Microsoft.AspNetCore.App" />
        <PackageReference Include="Scriban.Signed" Version="5.5.0" />
    </ItemGroup>

    <ItemGroup Condition="'$(TargetFramework)' != 'netstandard1.3' and '$(TargetFramework)' != 'net451' and '$(TargetFramework)' != 'net452' and '$(TargetFramework)' != 'net46' and '$(TargetFramework)' != 'net461'">
        <PackageReference Include="GraphQL.NewtonsoftJson" Version="8.2.1" />
        <PackageReference Include="MimeKitLite" Version="4.1.0.1" />
        <PackageReference Include="ProtoBufJsonConverter" Version="0.7.0" />
    </ItemGroup>

    <ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1' ">
        <PackageReference Include="Nullable" Version="1.3.1">
            <PrivateAssets>all</PrivateAssets>
            <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
        </PackageReference>
        <PackageReference Include="System.ComponentModel" Version="4.3.0" />
    </ItemGroup>

    <ItemGroup>
        <Compile Update="Server\WireMockServer.*.cs">
            <DependentUpon>WireMockServer.cs</DependentUpon>
        </Compile>
    </ItemGroup>

    <ItemGroup>
        <Compile Update="RequestBuilders\Request.*.cs">
            <DependentUpon>Request.cs</DependentUpon>
        </Compile>
    </ItemGroup>

    <ItemGroup>
        <Compile Update="ResponseBuilders\Response.*.cs">
            <DependentUpon>Response.cs</DependentUpon>
        </Compile>
    </ItemGroup>

    <ItemGroup>
        <PackageReference Include="Handlebars.Net.Helpers" Version="2.4.10" />
        <!--<PackageReference Include="Handlebars.Net.Helpers.DynamicLinq" Version="2.4.10" />-->
        <PackageReference Include="Handlebars.Net.Helpers.Humanizer" Version="2.4.10" />
        <PackageReference Include="Handlebars.Net.Helpers.Json" Version="2.4.10" />
        <PackageReference Include="Handlebars.Net.Helpers.Random" Version="2.4.10" />
        <PackageReference Include="Handlebars.Net.Helpers.Xeger" Version="2.4.10" />
        <PackageReference Include="Handlebars.Net.Helpers.XPath" Version="2.4.10" />
    </ItemGroup>

    <ItemGroup Condition="'$(TargetFramework)' != 'netstandard1.3' and '$(TargetFramework)' != 'net451' and '$(TargetFramework)' != 'net452' ">
        <PackageReference Include="Handlebars.Net.Helpers.Xslt" Version="2.4.6" />
    </ItemGroup>

    <ItemGroup>
        <!-- CVE-2021-26701 and https://github.com/WireMock-Net/WireMock.Net/issues/697 -->
        <PackageReference Include="System.Text.Encodings.Web" Version="4.7.2" />
    </ItemGroup>

    <ItemGroup>
        <ProjectReference Include="..\WireMock.Net.Abstractions\WireMock.Net.Abstractions.csproj" />
        <ProjectReference Include="..\WireMock.Org.Abstractions\WireMock.Org.Abstractions.csproj" />
    </ItemGroup>

    <ItemGroup Condition="'$(TargetFramework)' != 'netstandard1.3' and '$(TargetFramework)' != 'net451' and '$(TargetFramework)' != 'net452'">
        <ProjectReference Include="..\WireMock.Net.OpenApiParser\WireMock.Net.OpenApiParser.csproj" />
    </ItemGroup>
</Project>