<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <!-- net8.0-windows is required for the XboxAuthNet WebView2 OAuth flow:
         the netstandard2.0 build of XboxAuthNet has no WebUI implementation. -->
    <TargetFramework>net8.0-windows</TargetFramework>
    <UseWindowsForms>true</UseWindowsForms>
    <Nullable>enable</Nullable>
    <ApplicationManifest>app.manifest</ApplicationManifest>
    <AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
    <RootNamespace>ModpackLauncher</RootNamespace>
    <AssemblyName>ModpackLauncher</AssemblyName>
    <Version>0.4.5</Version>
    <ApplicationIcon Condition="Exists('Assets\icon.ico')">Assets\icon.ico</ApplicationIcon>

    <!-- Single-file self-contained publish defaults (Windows-only now due to WebView2) -->
    <RuntimeIdentifier Condition="'$(RuntimeIdentifier)' == ''">win-x64</RuntimeIdentifier>
    <RuntimeIdentifiers>win-x64</RuntimeIdentifiers>
    <PublishSingleFile>true</PublishSingleFile>
    <SelfContained>true</SelfContained>
    <IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
    <EnableCompressionInSingleFile>true</EnableCompressionInSingleFile>
    <DebugType>embedded</DebugType>
    <CopyDebugSymbolFilesFromPackages>false</CopyDebugSymbolFilesFromPackages>
    <CopyDocumentationFilesFromPackages>false</CopyDocumentationFilesFromPackages>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Avalonia" Version="12.0.2" />
    <PackageReference Include="Avalonia.Desktop" Version="12.0.2" />
    <PackageReference Include="Avalonia.Themes.Fluent" Version="12.0.2" />
    <PackageReference Include="Avalonia.Fonts.Inter" Version="12.0.2" />
    <PackageReference Include="AvaloniaUI.DiagnosticsSupport" Version="2.2.1">
      <IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets>
      <PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
    </PackageReference>
    <PackageReference Include="CmlLib.Core" Version="4.0.6" />
    <PackageReference Include="CmlLib.Core.Auth.Microsoft" Version="3.3.1" />
    <PackageReference Include="CmlLib.Core.Installer.Forge" Version="1.1.1" />
    <PackageReference Include="CmlLib.Core.Installer.NeoForge" Version="4.0.0" />
    <PackageReference Include="XboxAuthNet.Game.Msal" Version="0.1.3" />
    <PackageReference Include="fNbt" Version="0.7.1" />
  </ItemGroup>

  <ItemGroup>
    <EmbeddedResource Include="launcher-config.json" Condition="Exists('launcher-config.json')">
      <LogicalName>launcher-config.json</LogicalName>
    </EmbeddedResource>
    <EmbeddedResource Include="launcher-config.template.json">
      <LogicalName>launcher-config.template.json</LogicalName>
    </EmbeddedResource>
  </ItemGroup>

  <ItemGroup>
    <AvaloniaResource Include="Assets\icon.png" />
    <AvaloniaResource Include="Assets\noise.png" />
  </ItemGroup>

  <Target Name="StripNativePdbs" AfterTargets="Publish">
    <ItemGroup>
      <_StripPdb Include="$(PublishDir)*.pdb" Exclude="$(PublishDir)$(AssemblyName).pdb" />
    </ItemGroup>
    <Delete Files="@(_StripPdb)" />
  </Target>
</Project>
