<Project Sdk="Microsoft.NET.Sdk">
  <Import Project="..\..\Version.props" />
  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net8.0-windows10.0.20348.0</TargetFramework>
    <TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
    <SupportedOSPlatformVersion>10.0.19041.0</SupportedOSPlatformVersion>
    <RootNamespace>Microsoft.PowerToys.Settings.UI</RootNamespace>
    <ApplicationManifest>app.manifest</ApplicationManifest>
    <RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
    <UseWinUI>true</UseWinUI>
    <EnablePreviewMsixTooling>true</EnablePreviewMsixTooling>
    <WindowsPackageType>None</WindowsPackageType>
    <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
    <AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
    <ApplicationIcon>Assets\Settings\icon.ico</ApplicationIcon>
    <WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
    <!-- OutputPath looks like this because it has to be called both by settings and publish.cmd -->
    <OutputPath>..\..\..\$(Platform)\$(Configuration)\WinUI3Apps</OutputPath>
    <SelfContained>true</SelfContained>
    <!-- MRT from windows app sdk will search for a pri file with the same name of the module before defaulting to resources.pri -->
    <ProjectPriFileName>PowerToys.Settings.pri</ProjectPriFileName>
  </PropertyGroup>

  <ItemGroup>
    <Page Remove="SettingsXAML\App.xaml" />
  </ItemGroup>
  <ItemGroup>
    <ApplicationDefinition Include="SettingsXAML\App.xaml" />
  </ItemGroup>

  <!-- SelfContained=true requires RuntimeIdentifier to be set -->
  <PropertyGroup Condition="'$(Platform)'=='x64'">
    <RuntimeIdentifier>win-x64</RuntimeIdentifier>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Platform)'=='ARM64'">
    <RuntimeIdentifier>win-arm64</RuntimeIdentifier>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)'=='Debug'">
    <NoWarn></NoWarn>
    <TreatWarningsAsErrors>True</TreatWarningsAsErrors>
    <WarningsNotAsErrors>CA1720</WarningsNotAsErrors>
    <Optimize>False</Optimize>
    <DebugType>full</DebugType>
    <DebugSymbols>true</DebugSymbols>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)'=='Release'">
    <NoWarn></NoWarn>
    <TreatWarningsAsErrors>True</TreatWarningsAsErrors>
    <WarningsNotAsErrors>CA1720</WarningsNotAsErrors>
    <Optimize>true</Optimize>
  </PropertyGroup>

  <!-- See https://learn.microsoft.com/windows/apps/develop/platform/csharp-winrt/net-projection-from-cppwinrt-component for more info -->
  <PropertyGroup>
    <CsWinRTIncludes>PowerToys.GPOWrapper</CsWinRTIncludes>
    <CsWinRTGeneratedFilesDir>$(OutDir)</CsWinRTGeneratedFilesDir>
    <ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
  </PropertyGroup>

  <ItemGroup>
    <Content Include="Assets\Settings\SplashScreen.scale-200.png" />
    <Content Include="Assets\Settings\LockScreenLogo.scale-200.png" />
    <Content Include="Assets\Settings\Square150x150Logo.scale-200.png" />
    <Content Include="Assets\Settings\Square44x44Logo.scale-200.png" />
    <Content Include="Assets\Settings\Square44x44Logo.targetsize-24_altform-unplated.png" />
    <Content Include="Assets\Settings\StoreLogo.png" />
    <Content Include="Assets\Settings\Wide310x150Logo.scale-200.png" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="CommunityToolkit.WinUI.Controls.SettingsControls" />
    <PackageReference Include="CommunityToolkit.WinUI.Controls.Primitives" />
    <PackageReference Include="CommunityToolkit.WinUI.Animations" />
    <PackageReference Include="CommunityToolkit.WinUI.Extensions" />
    <PackageReference Include="CommunityToolkit.WinUI.Converters" />
    <PackageReference Include="CommunityToolkit.WinUI.UI.Controls.Markdown" />
    <PackageReference Include="Microsoft.Windows.CsWinRT" />
    <PackageReference Include="WinUIEx" />
    <PackageReference Include="Microsoft.WindowsAppSDK" />
    <PackageReference Include="Microsoft.Windows.SDK.BuildTools" />
    <PackageReference Include="Microsoft.Xaml.Behaviors.WinUI.Managed" />
    <PackageReference Include="StreamJsonRpc" />
    <!-- HACK: Microsoft.Extensions.Hosting is referenced, even if it is not used, to force dll versions to be the same as in other projects. Really only needed since the Experimentation APIs that are added in CI reference some net standard 2.0 assemblies. -->
    <PackageReference Include="Microsoft.Extensions.Hosting" />
    <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 '$(EnablePreviewMsixTooling)'=='true'">
    <ProjectCapability Include="Msix" />
  </ItemGroup>

  <ItemGroup>
    <!-- HACK: Common.UI is referenced, even if it is not used, to force dll versions to be the same as in other projects that use it. It's still unclear why this is the case, but this is need for flattening the install directory. -->
    <ProjectReference Include="..\..\common\Common.UI\Common.UI.csproj" />
    <ProjectReference Include="..\..\common\AllExperiments\AllExperiments.csproj" />
    <ProjectReference Include="..\..\common\GPOWrapper\GPOWrapper.vcxproj" />
    <ProjectReference Include="..\..\common\interop\PowerToys.Interop.vcxproj" />
    <ProjectReference Include="..\..\common\ManagedCommon\ManagedCommon.csproj" />
    <ProjectReference Include="..\..\common\ManagedTelemetry\Telemetry\ManagedTelemetry.csproj" />
    <ProjectReference Include="..\Settings.UI.Library\Settings.UI.Library.csproj" />
  </ItemGroup>

  <PropertyGroup>
    <!-- TODO: fix issues and reenable -->
    <!-- These are caused by streamjsonrpc dependency on Microsoft.VisualStudio.Threading.Analyzers -->
    <!-- We might want to add that to the project and fix the issues as well -->
    <NoWarn>VSTHRD002;VSTHRD110;VSTHRD100;VSTHRD200;VSTHRD101</NoWarn>
  </PropertyGroup>

  <ItemGroup>
    <None Update="Assets\Settings\icon.ico">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
  </ItemGroup>

  <ItemGroup>
    <None Update="Assets\Settings\Scripts\CheckCmdNotFoundRequirements.ps1">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
    <None Update="Assets\Settings\Scripts\InstallWinGetClientModule.ps1">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
    <None Update="Assets\Settings\Scripts\InstallPowerShell7.ps1">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
    <None Update="Assets\Settings\Scripts\EnableModule.ps1">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
    <None Update="Assets\Settings\Scripts\DisableModule.ps1">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
  </ItemGroup>

</Project>
