<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net10.0-windows10.0.19041.0</TargetFramework>
    <TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
    <Platforms>x64</Platforms>
    <UseWinUI>true</UseWinUI>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
    <DefineConstants>$(DefineConstants);DISABLE_XAML_GENERATED_MAIN</DefineConstants>
    <ApplicationManifest>app.manifest</ApplicationManifest>
    <ApplicationIcon>Assets\app_icon.ico</ApplicationIcon>
    <WindowsPackageType>None</WindowsPackageType>
    <EnableMsixTooling>true</EnableMsixTooling>
    <WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
    <RootNamespace>YMhut.Box.WinUI</RootNamespace>
    <AssemblyName>YMhutBox</AssemblyName>
    <DefaultLanguage>zh-CN</DefaultLanguage>
    <SatelliteResourceLanguages>zh-CN;en-US</SatelliteResourceLanguages>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
    <WindowsPackageType>None</WindowsPackageType>
    <GenerateAppxPackageOnBuild>false</GenerateAppxPackageOnBuild>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
    <RuntimeIdentifier>win-x64</RuntimeIdentifier>
    <WindowsPackageType>MSIX</WindowsPackageType>
    <GenerateAppxPackageOnBuild>true</GenerateAppxPackageOnBuild>
    <AppxPackageSigningEnabled>false</AppxPackageSigningEnabled>
    <AppxBundle>Never</AppxBundle>
    <DebugType>none</DebugType>
    <DebugSymbols>false</DebugSymbols>
    <CopyOutputSymbolsToPublishDirectory>false</CopyOutputSymbolsToPublishDirectory>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.0" />
    <PackageReference Include="Microsoft.WindowsAppSDK" Version="1.8.260416003" />
    <PackageReference Include="Microsoft.Web.WebView2" Version="1.0.3967.48" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\YMhut.Box.Core\YMhut.Box.Core.csproj" />
    <ProjectReference Include="..\YMhut.Box.DownloadHost\YMhut.Box.DownloadHost.csproj" ReferenceOutputAssembly="false" PrivateAssets="all" />
    <ProjectReference Include="..\YMhut.Box.PluginHost\YMhut.Box.PluginHost.csproj" ReferenceOutputAssembly="false" PrivateAssets="all" />
    <ProjectReference Include="..\YMhut.Box.Worker\YMhut.Box.Worker.csproj" ReferenceOutputAssembly="false" PrivateAssets="all" />
  </ItemGroup>
  <ItemGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
    <AppxManifest Include="Package.appxmanifest" />
  </ItemGroup>
  <ItemGroup>
    <Content Include="Assets\app_icon.ico" CopyToOutputDirectory="PreserveNewest" />
    <Content Include="Assets\*.png" CopyToOutputDirectory="PreserveNewest" />
    <Content Include="Assets\startup-splash\**\*.*" CopyToOutputDirectory="PreserveNewest" />
    <Content Include="Assets\home-globe\**\*.*" CopyToOutputDirectory="PreserveNewest" />
    <Content Include="Assets\tool-pages\**\*.*" CopyToOutputDirectory="PreserveNewest" />
    <Content Include="Assets\tool-results\**\*.*" CopyToOutputDirectory="PreserveNewest" />
    <Content Remove="Assets\home-globe\textures\solar\solar-texture-manifest.json" />
    <EmbeddedResource Include="..\..\version.json">
      <LogicalName>YMhut.Box.WinUI.version.json</LogicalName>
    </EmbeddedResource>
    <Content Include="..\..\assets\download.svg">
      <Link>Assets\download.svg</Link>
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Remove="Assets\home-globe\textures\solar\source\**\*.*" />
    <Content Remove="Assets\home-globe\textures\solar\optimized\**\*.*" />
    <Content Include="..\..\assets\icons\**\*.*">
      <Link>Assets\icons\%(RecursiveDir)%(FileName)%(Extension)</Link>
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Include="..\..\assets\images\**\*.*">
      <Link>Assets\images\%(RecursiveDir)%(FileName)%(Extension)</Link>
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Remove="..\..\assets\images\loading.gif" />
    <Content Include="..\..\assets\data\**\*.*">
      <Link>Assets\data\%(RecursiveDir)%(FileName)%(Extension)</Link>
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
  </ItemGroup>
  <ItemGroup>
    <ExternalToolPayload Include="..\..\tubatool-参考补充项目\Tools\**\*.*" />
    <ExternalToolMetadata Include="..\..\tubatool-参考补充项目\Metadata\**\*.*" />
  </ItemGroup>
  <ItemGroup>
    <Page Remove="Views\**\*.xaml" />
    <None Include="Views\**\*.xaml" />
  </ItemGroup>
  <Target Name="CopyExternalToolPayload" AfterTargets="Build">
    <Copy SourceFiles="@(ExternalToolPayload)"
          DestinationFiles="@(ExternalToolPayload->'$(OutDir)Tools\%(RecursiveDir)%(Filename)%(Extension)')"
          SkipUnchangedFiles="true"
          Condition="'@(ExternalToolPayload)' != '' and '$(ExcludeExternalTools)' != 'true'" />
    <Copy SourceFiles="@(ExternalToolMetadata)"
          DestinationFiles="@(ExternalToolMetadata->'$(OutDir)Metadata\%(RecursiveDir)%(Filename)%(Extension)')"
          SkipUnchangedFiles="true"
          Condition="'@(ExternalToolMetadata)' != ''" />
  </Target>
  <Target Name="CopyExternalToolPayloadPublish" AfterTargets="Publish">
    <Copy SourceFiles="@(ExternalToolPayload)"
          DestinationFiles="@(ExternalToolPayload->'$(PublishDir)Tools\%(RecursiveDir)%(Filename)%(Extension)')"
          SkipUnchangedFiles="true"
          Condition="'$(PublishDir)' != '' and '@(ExternalToolPayload)' != '' and '$(ExcludeExternalTools)' != 'true'" />
    <Copy SourceFiles="@(ExternalToolMetadata)"
          DestinationFiles="@(ExternalToolMetadata->'$(PublishDir)Metadata\%(RecursiveDir)%(Filename)%(Extension)')"
          SkipUnchangedFiles="true"
          Condition="'$(PublishDir)' != '' and '@(ExternalToolMetadata)' != ''" />
  </Target>
  <Target Name="CopyToolWorkerOutput" AfterTargets="Build">
    <RemoveDir Directories="$(OutDir)worker\runtimes;$(OutDir)worker\net6.0;$(OutDir)plugin-host\runtimes;$(OutDir)plugin-host\net6.0;$(OutDir)Assets\fonts" />
    <Delete Files="$(OutDir)Assets\images\loading.gif;$(OutDir)worker\e_sqlite3.dll;$(OutDir)plugin-host\e_sqlite3.dll" />
    <ItemGroup>
      <ToolWorkerOutput Include="..\YMhut.Box.Worker\bin\$(Platform)\$(Configuration)\net10.0\**\*.*"
                        Exclude="..\YMhut.Box.Worker\bin\$(Platform)\$(Configuration)\net10.0\runtimes\**\*.*" />
      <ToolWorkerWinLib Include="..\YMhut.Box.Worker\bin\$(Platform)\$(Configuration)\net10.0\runtimes\win\lib\**\*.*" />
      <ToolWorkerWinX64Native Include="..\YMhut.Box.Worker\bin\$(Platform)\$(Configuration)\net10.0\runtimes\win-x64\native\**\*.*" />
      <PluginHostOutput Include="..\YMhut.Box.PluginHost\bin\$(Platform)\$(Configuration)\net10.0\**\*.*"
                        Exclude="..\YMhut.Box.PluginHost\bin\$(Platform)\$(Configuration)\net10.0\runtimes\**\*.*" />
      <PluginHostWinLib Include="..\YMhut.Box.PluginHost\bin\$(Platform)\$(Configuration)\net10.0\runtimes\win\lib\**\*.*" />
      <PluginHostWinX64Native Include="..\YMhut.Box.PluginHost\bin\$(Platform)\$(Configuration)\net10.0\runtimes\win-x64\native\**\*.*" />
    </ItemGroup>
    <Copy SourceFiles="@(ToolWorkerOutput)"
          DestinationFiles="@(ToolWorkerOutput->'$(OutDir)worker\%(RecursiveDir)%(Filename)%(Extension)')"
          SkipUnchangedFiles="true"
          Condition="'@(ToolWorkerOutput)' != ''" />
    <Copy SourceFiles="@(ToolWorkerWinLib)"
          DestinationFiles="@(ToolWorkerWinLib->'$(OutDir)worker\runtimes\win\lib\%(RecursiveDir)%(Filename)%(Extension)')"
          SkipUnchangedFiles="true"
          Condition="'@(ToolWorkerWinLib)' != ''" />
    <Copy SourceFiles="@(ToolWorkerWinX64Native)"
          DestinationFiles="@(ToolWorkerWinX64Native->'$(OutDir)worker\runtimes\win-x64\native\%(RecursiveDir)%(Filename)%(Extension)')"
          SkipUnchangedFiles="true"
          Condition="'@(ToolWorkerWinX64Native)' != ''" />
    <Copy SourceFiles="@(PluginHostOutput)"
          DestinationFiles="@(PluginHostOutput->'$(OutDir)plugin-host\%(RecursiveDir)%(Filename)%(Extension)')"
          SkipUnchangedFiles="true"
          Condition="'@(PluginHostOutput)' != ''" />
    <Copy SourceFiles="@(PluginHostWinLib)"
          DestinationFiles="@(PluginHostWinLib->'$(OutDir)plugin-host\runtimes\win\lib\%(RecursiveDir)%(Filename)%(Extension)')"
          SkipUnchangedFiles="true"
          Condition="'@(PluginHostWinLib)' != ''" />
    <Copy SourceFiles="@(PluginHostWinX64Native)"
          DestinationFiles="@(PluginHostWinX64Native->'$(OutDir)plugin-host\runtimes\win-x64\native\%(RecursiveDir)%(Filename)%(Extension)')"
          SkipUnchangedFiles="true"
          Condition="'@(PluginHostWinX64Native)' != ''" />
  </Target>
  <Target Name="CopyToolWorkerPublishOutput" AfterTargets="Publish">
    <RemoveDir Directories="$(PublishDir)worker\runtimes;$(PublishDir)worker\net6.0;$(PublishDir)plugin-host\runtimes;$(PublishDir)plugin-host\net6.0;$(PublishDir)Assets\fonts"
               Condition="'$(PublishDir)' != ''" />
    <Delete Files="$(PublishDir)Assets\images\loading.gif;$(PublishDir)worker\e_sqlite3.dll;$(PublishDir)plugin-host\e_sqlite3.dll"
            Condition="'$(PublishDir)' != ''" />
    <ItemGroup>
      <ToolWorkerPublishOutput Include="..\YMhut.Box.Worker\bin\$(Platform)\$(Configuration)\net10.0\**\*.*"
                               Exclude="..\YMhut.Box.Worker\bin\$(Platform)\$(Configuration)\net10.0\runtimes\**\*.*" />
      <ToolWorkerPublishOutput Include="..\YMhut.Box.Worker\bin\$(Configuration)\net10.0\$(RuntimeIdentifier)\**\*.*"
                               Exclude="..\YMhut.Box.Worker\bin\$(Configuration)\net10.0\$(RuntimeIdentifier)\runtimes\**\*.*"
                               Condition="'$(RuntimeIdentifier)' != ''" />
      <ToolWorkerPublishWinLib Include="..\YMhut.Box.Worker\bin\$(Platform)\$(Configuration)\net10.0\runtimes\win\lib\**\*.*" />
      <ToolWorkerPublishWinX64Native Include="..\YMhut.Box.Worker\bin\$(Platform)\$(Configuration)\net10.0\runtimes\win-x64\native\**\*.*" />
      <PluginHostPublishOutput Include="..\YMhut.Box.PluginHost\bin\$(Platform)\$(Configuration)\net10.0\**\*.*"
                               Exclude="..\YMhut.Box.PluginHost\bin\$(Platform)\$(Configuration)\net10.0\runtimes\**\*.*" />
      <PluginHostPublishOutput Include="..\YMhut.Box.PluginHost\bin\$(Configuration)\net10.0\$(RuntimeIdentifier)\**\*.*"
                               Exclude="..\YMhut.Box.PluginHost\bin\$(Configuration)\net10.0\$(RuntimeIdentifier)\runtimes\**\*.*"
                               Condition="'$(RuntimeIdentifier)' != ''" />
      <PluginHostPublishWinLib Include="..\YMhut.Box.PluginHost\bin\$(Platform)\$(Configuration)\net10.0\runtimes\win\lib\**\*.*" />
      <PluginHostPublishWinX64Native Include="..\YMhut.Box.PluginHost\bin\$(Platform)\$(Configuration)\net10.0\runtimes\win-x64\native\**\*.*" />
    </ItemGroup>
    <Copy SourceFiles="@(ToolWorkerPublishOutput)"
          DestinationFiles="@(ToolWorkerPublishOutput->'$(PublishDir)worker\%(RecursiveDir)%(Filename)%(Extension)')"
          SkipUnchangedFiles="true"
          Condition="'$(PublishDir)' != '' and '@(ToolWorkerPublishOutput)' != ''" />
    <Copy SourceFiles="@(ToolWorkerPublishWinLib)"
          DestinationFiles="@(ToolWorkerPublishWinLib->'$(PublishDir)worker\runtimes\win\lib\%(RecursiveDir)%(Filename)%(Extension)')"
          SkipUnchangedFiles="true"
          Condition="'$(PublishDir)' != '' and '@(ToolWorkerPublishWinLib)' != ''" />
    <Copy SourceFiles="@(ToolWorkerPublishWinX64Native)"
          DestinationFiles="@(ToolWorkerPublishWinX64Native->'$(PublishDir)worker\runtimes\win-x64\native\%(RecursiveDir)%(Filename)%(Extension)')"
          SkipUnchangedFiles="true"
          Condition="'$(PublishDir)' != '' and '@(ToolWorkerPublishWinX64Native)' != ''" />
    <Copy SourceFiles="@(PluginHostPublishOutput)"
          DestinationFiles="@(PluginHostPublishOutput->'$(PublishDir)plugin-host\%(RecursiveDir)%(Filename)%(Extension)')"
          SkipUnchangedFiles="true"
          Condition="'$(PublishDir)' != '' and '@(PluginHostPublishOutput)' != ''" />
    <Copy SourceFiles="@(PluginHostPublishWinLib)"
          DestinationFiles="@(PluginHostPublishWinLib->'$(PublishDir)plugin-host\runtimes\win\lib\%(RecursiveDir)%(Filename)%(Extension)')"
          SkipUnchangedFiles="true"
          Condition="'$(PublishDir)' != '' and '@(PluginHostPublishWinLib)' != ''" />
    <Copy SourceFiles="@(PluginHostPublishWinX64Native)"
          DestinationFiles="@(PluginHostPublishWinX64Native->'$(PublishDir)plugin-host\runtimes\win-x64\native\%(RecursiveDir)%(Filename)%(Extension)')"
          SkipUnchangedFiles="true"
          Condition="'$(PublishDir)' != '' and '@(PluginHostPublishWinX64Native)' != ''" />
  </Target>
  <Target Name="CopyDownloadHostOutput" AfterTargets="Build">
    <RemoveDir Directories="$(OutDir)download-host\runtimes" />
    <ItemGroup>
      <DownloadHostOutput Include="..\YMhut.Box.DownloadHost\bin\$(Platform)\$(Configuration)\net10.0\**\*.*"
                          Exclude="..\YMhut.Box.DownloadHost\bin\$(Platform)\$(Configuration)\net10.0\runtimes\**\*.*" />
      <DownloadHostWinLib Include="..\YMhut.Box.DownloadHost\bin\$(Platform)\$(Configuration)\net10.0\runtimes\win\lib\**\*.*" />
      <DownloadHostWinX64Native Include="..\YMhut.Box.DownloadHost\bin\$(Platform)\$(Configuration)\net10.0\runtimes\win-x64\native\**\*.*" />
    </ItemGroup>
    <Copy SourceFiles="@(DownloadHostOutput)"
          DestinationFiles="@(DownloadHostOutput->'$(OutDir)download-host\%(RecursiveDir)%(Filename)%(Extension)')"
          SkipUnchangedFiles="true"
          Condition="'@(DownloadHostOutput)' != ''" />
    <Copy SourceFiles="@(DownloadHostWinLib)"
          DestinationFiles="@(DownloadHostWinLib->'$(OutDir)download-host\runtimes\win\lib\%(RecursiveDir)%(Filename)%(Extension)')"
          SkipUnchangedFiles="true"
          Condition="'@(DownloadHostWinLib)' != ''" />
    <Copy SourceFiles="@(DownloadHostWinX64Native)"
          DestinationFiles="@(DownloadHostWinX64Native->'$(OutDir)download-host\runtimes\win-x64\native\%(RecursiveDir)%(Filename)%(Extension)')"
          SkipUnchangedFiles="true"
          Condition="'@(DownloadHostWinX64Native)' != ''" />
  </Target>
  <Target Name="CopyDownloadHostPublishOutput" AfterTargets="Publish">
    <RemoveDir Directories="$(PublishDir)download-host\runtimes"
               Condition="'$(PublishDir)' != ''" />
    <ItemGroup>
      <DownloadHostPublishOutput Include="..\YMhut.Box.DownloadHost\bin\$(Platform)\$(Configuration)\net10.0\**\*.*"
                                 Exclude="..\YMhut.Box.DownloadHost\bin\$(Platform)\$(Configuration)\net10.0\runtimes\**\*.*" />
      <DownloadHostPublishOutput Include="..\YMhut.Box.DownloadHost\bin\$(Configuration)\net10.0\$(RuntimeIdentifier)\**\*.*"
                                 Exclude="..\YMhut.Box.DownloadHost\bin\$(Configuration)\net10.0\$(RuntimeIdentifier)\runtimes\**\*.*"
                                 Condition="'$(RuntimeIdentifier)' != ''" />
      <DownloadHostPublishWinLib Include="..\YMhut.Box.DownloadHost\bin\$(Platform)\$(Configuration)\net10.0\runtimes\win\lib\**\*.*" />
      <DownloadHostPublishWinX64Native Include="..\YMhut.Box.DownloadHost\bin\$(Platform)\$(Configuration)\net10.0\runtimes\win-x64\native\**\*.*" />
    </ItemGroup>
    <Copy SourceFiles="@(DownloadHostPublishOutput)"
          DestinationFiles="@(DownloadHostPublishOutput->'$(PublishDir)download-host\%(RecursiveDir)%(Filename)%(Extension)')"
          SkipUnchangedFiles="true"
          Condition="'$(PublishDir)' != '' and '@(DownloadHostPublishOutput)' != ''" />
    <Copy SourceFiles="@(DownloadHostPublishWinLib)"
          DestinationFiles="@(DownloadHostPublishWinLib->'$(PublishDir)download-host\runtimes\win\lib\%(RecursiveDir)%(Filename)%(Extension)')"
          SkipUnchangedFiles="true"
          Condition="'$(PublishDir)' != '' and '@(DownloadHostPublishWinLib)' != ''" />
    <Copy SourceFiles="@(DownloadHostPublishWinX64Native)"
          DestinationFiles="@(DownloadHostPublishWinX64Native->'$(PublishDir)download-host\runtimes\win-x64\native\%(RecursiveDir)%(Filename)%(Extension)')"
          SkipUnchangedFiles="true"
          Condition="'$(PublishDir)' != '' and '@(DownloadHostPublishWinX64Native)' != ''" />
  </Target>
</Project>
