42ebee50b7
- build.bat:publish 后清理产物 + upx -9 自动压缩,支持 SKIP_UPX 跳过、缺 upx 仅警告 - csproj:新增框架依赖单文件发布路径(非 AOT 时),.Static 包改为仅 AOT 引用
101 lines
4.4 KiB
XML
101 lines
4.4 KiB
XML
<Project Sdk="Microsoft.NET.Sdk">
|
||
|
||
<PropertyGroup>
|
||
<OutputType>WinExe</OutputType>
|
||
<TargetFramework>net10.0-windows</TargetFramework>
|
||
<Nullable>enable</Nullable>
|
||
<LangVersion>latest</LangVersion>
|
||
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
|
||
<ApplicationIcon>Assets\claude.ico</ApplicationIcon>
|
||
<RootNamespace>Notify</RootNamespace>
|
||
<AssemblyName>notify</AssemblyName>
|
||
<Version>1.0.0</Version>
|
||
<IsAotCompatible>true</IsAotCompatible>
|
||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||
</PropertyGroup>
|
||
|
||
<!-- 框架依赖单文件发布(默认,仅 publish 生效):需目标机装 .NET 10 运行时
|
||
原生库(Skia/HarfBuzz/ANGLE)随单文件打包、运行时自解压 -->
|
||
<PropertyGroup Condition="'$(PublishAot)' != 'true'">
|
||
<PublishSingleFile>true</PublishSingleFile>
|
||
<SelfContained>false</SelfContained>
|
||
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
|
||
<DebuggerSupport>false</DebuggerSupport>
|
||
</PropertyGroup>
|
||
|
||
<!-- NativeAOT 发布配置(需 -p:PublishAot=true,仅 publish 生效):单文件原生 exe -->
|
||
<PropertyGroup Condition="'$(PublishAot)' == 'true'">
|
||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||
<StripSymbols>true</StripSymbols>
|
||
<DebuggerSupport>false</DebuggerSupport>
|
||
<OptimizationPreference>Size</OptimizationPreference>
|
||
</PropertyGroup>
|
||
|
||
<ItemGroup>
|
||
<AvaloniaResource Include="Assets\**" />
|
||
</ItemGroup>
|
||
|
||
<!-- 这些 UI 库未完全标注 trim/AOT 安全,整体保留避免裁剪导致运行时异常 -->
|
||
<ItemGroup Condition="'$(PublishAot)' == 'true'">
|
||
<TrimmerRootAssembly Include="Ursa" />
|
||
<TrimmerRootAssembly Include="Ursa.Themes.Semi" />
|
||
<TrimmerRootAssembly Include="Semi.Avalonia" />
|
||
</ItemGroup>
|
||
|
||
<ItemGroup>
|
||
<PackageReference Include="Avalonia" Version="12.0.4" />
|
||
<PackageReference Include="Avalonia.Desktop" Version="12.0.4" />
|
||
<PackageReference Include="Avalonia.Fonts.Inter" Version="12.0.4" />
|
||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.2" />
|
||
<PackageReference Include="Semi.Avalonia" Version="12.0.3" />
|
||
<PackageReference Include="Irihi.Ursa" Version="2.0.1" />
|
||
<PackageReference Include="Irihi.Ursa.Themes.Semi" Version="2.0.1" />
|
||
</ItemGroup>
|
||
|
||
<!--
|
||
AOT 单文件:把 Skia / HarfBuzz / ANGLE 三个原生库静态链接进 exe
|
||
CoreUtils.SkiaSharp.Static 含 skia + libHarfBuzzSharp 的 .lib,CoreUtils.ANGLE.Static 含 ANGLE
|
||
两包各自的 .targets 会在 PublishAot 时自动追加 NativeLibrary,这里只补 DirectPInvoke 与系统 lib
|
||
版本对应:Avalonia 12 → SkiaSharp 3.119
|
||
仅 AOT 需要;框架依赖单文件用 Avalonia 自带的动态 Skia 原生库
|
||
-->
|
||
<ItemGroup Condition="'$(PublishAot)' == 'true'">
|
||
<PackageReference Include="CoreUtils.SkiaSharp.Static" Version="3.119.0.1" />
|
||
<PackageReference Include="CoreUtils.ANGLE.Static" Version="7151.0.1" />
|
||
</ItemGroup>
|
||
|
||
<ItemGroup Condition="'$(PublishAot)' == 'true'">
|
||
<DirectPInvoke Include="libSkiaSharp" />
|
||
<DirectPInvoke Include="libHarfBuzzSharp" />
|
||
<DirectPInvoke Include="av_libglesv2" />
|
||
<!-- ANGLE 静态库需要的系统库 -->
|
||
<LinkerArg Include="gdi32.lib" />
|
||
<LinkerArg Include="user32.lib" />
|
||
<LinkerArg Include="d3d9.lib" />
|
||
<LinkerArg Include="dxgi.lib" />
|
||
<LinkerArg Include="dxguid.lib" />
|
||
<LinkerArg Include="synchronization.lib" />
|
||
</ItemGroup>
|
||
|
||
<!-- 静态链接后清理发布目录:动态原生 DLL、链接期 .lib、调试 .pdb 都不需要,只留 notify.exe -->
|
||
<Target Name="CleanAotSingleFileOutput" AfterTargets="Publish" Condition="'$(PublishAot)' == 'true'">
|
||
<ItemGroup>
|
||
<_AotJunk Include="$(PublishDir)*.dll" />
|
||
<_AotJunk Include="$(PublishDir)*.lib" />
|
||
<_AotJunk Include="$(PublishDir)*.pdb" />
|
||
</ItemGroup>
|
||
<Delete Files="@(_AotJunk)" />
|
||
</Target>
|
||
|
||
<!-- 框架依赖单文件清理:原生库符号(libSkiaSharp.pdb 等)与托管 .pdb 发布不需要,只留 notify.exe -->
|
||
<Target Name="CleanSingleFileOutput" AfterTargets="Publish" Condition="'$(PublishAot)' != 'true' And '$(PublishSingleFile)' == 'true'">
|
||
<ItemGroup>
|
||
<_SingleFileJunk Include="$(PublishDir)*.pdb" />
|
||
</ItemGroup>
|
||
<Delete Files="@(_SingleFileJunk)" />
|
||
</Target>
|
||
|
||
</Project>
|