<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <RootNamespace>Olive</RootNamespace>
    <ApplicationManifest>app.manifest</ApplicationManifest>

    <WindowsSdkPackageVersion>10.0.26100.68-preview</WindowsSdkPackageVersion>
    <TargetFramework>net10.0-windows10.0.22621.0</TargetFramework>
    <TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
    <SupportedOSPlatformVersion>10.0.19041.0</SupportedOSPlatformVersion>
    <RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>

    <PublishProfile>win-$(Platform).pubxml</PublishProfile>
    <EnableMsixTooling>true</EnableMsixTooling>
    <Nullable>enable</Nullable>
    <UseWindowsForms>true</UseWindowsForms>
    <NoWarn>$(NoWarn);APPX1707</NoWarn>
  </PropertyGroup>

  <ItemGroup>
    <Content Include="Assets\SplashScreen.scale-200.png"/>
    <Content Include="Assets\AppLogo150.scale-200.png"/>
    <Content Include="Assets\AppLogo44.scale-200.png"/>
    <Content Include="Assets\AppLogo44.targetsize-24_altform-unplated.png"/>
    <Content Include="Assets\StoreLogo.png"/>
    <Content Include="Assets\Wide310x150Logo.scale-200.png"/>
  </ItemGroup>

  <ItemGroup>
    <Manifest Include="$(ApplicationManifest)"/>
  </ItemGroup>

  <!--
    Defining the "Msix" ProjectCapability here allows the Single-project MSIX Packaging
    Tools extension to be activated for this project even if the Windows App SDK Nuget
    package has not yet been restored.
  -->
  <ItemGroup Condition="'$(DisableMsixProjectCapabilityAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
    <ProjectCapability Include="Msix"/>
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.CommandPalette.Extensions"/>
    <PackageReference Include="Microsoft.Windows.CsWinRT"/>
    <PackageReference Include="Shmuelie.WinRTServer"/>

    <!-- Needed to enable building an MSIX package -->
    <PackageReference Include="Microsoft.Windows.SDK.BuildTools.MSIX">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
    </PackageReference>
  </ItemGroup>

  <!--
    Defining the "HasPackageAndPublishMenuAddedByProject" property here allows the Solution
    Explorer "Package and Publish" context menu entry to be enabled for this project even if
    the Windows App SDK Nuget package has not yet been restored.
  -->
  <PropertyGroup Condition="'$(DisableHasPackageAndPublishMenuAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
    <HasPackageAndPublishMenu>true</HasPackageAndPublishMenu>
  </PropertyGroup>

  <PropertyGroup>
    <PublishSingleFile>true</PublishSingleFile>
    <IsAotCompatible>true</IsAotCompatible>

    <CsWinRTAotOptimizerEnabled>true</CsWinRTAotOptimizerEnabled>
    <CsWinRTAotWarningLevel>2</CsWinRTAotWarningLevel>
    <!-- Suppress DynamicallyAccessedMemberTypes.PublicParameterlessConstructor in fallback code path of Windows SDK projection -->
    <WarningsNotAsErrors>IL2081;$(WarningsNotAsErrors)</WarningsNotAsErrors>

    <!-- When publishing trimmed, make sure to treat trimming warnings as build errors -->
    <ILLinkTreatWarningsAsErrors>true</ILLinkTreatWarningsAsErrors>

  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)'=='Debug'">
    <!-- In Debug builds, trimming is disabled by default, but all the trim &
         AOT warnings are enabled. This gives debug builds a tighter inner loop,
         while at least warning about future trim violations -->
    <PublishTrimmed>false</PublishTrimmed>

    <EnableTrimAnalyzer>true</EnableTrimAnalyzer>
    <EnableSingleFileAnalyzer>true</EnableSingleFileAnalyzer>
    <EnableAotAnalyzer>true</EnableAotAnalyzer>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)'!='Debug'">
    <!-- Windows Forms clipboard access is used to copy real GIF files; it is not trim-compatible. -->
    <PublishTrimmed>false</PublishTrimmed>

    <!-- In release, also ignore the aforementioned ILLink warning -->
    <ILLinkTreatWarningsAsErrors>false</ILLinkTreatWarningsAsErrors>
  </PropertyGroup>


</Project>
