支持aot

This commit is contained in:
token 2024-09-12 09:33:12 +08:00 committed by GitHub
parent d6f656ec08
commit 9c061d0f93
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 41 additions and 9 deletions

5
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,5 @@
{
"githubPullRequests.ignoredPullRequestBranches": [
"develop"
]
}

View File

@ -6,13 +6,26 @@
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>AtomUI.Demo.Desktop</RootNamespace>
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
</PropertyGroup>
<ItemGroup>
<AvaloniaResource Include="Assets\**"/>
<TrimmerRootDescriptor Include="Roots.xml"/>
</ItemGroup>
<ItemGroup>
<TrimmerRootDescriptor Include="Roots.xml" />
</ItemGroup>
<PropertyGroup>
<IsTrimmable>true</IsTrimmable>
<PublishTrimmed>true</PublishTrimmed>
<PublishAot>true</PublishAot>
</PropertyGroup>
<PropertyGroup>
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
<ApplicationManifest>app.manifest</ApplicationManifest>

View File

@ -18,18 +18,25 @@ internal class Program
[STAThread]
public static void Main(string[] args)
{
BuildAvaloniaApp()
.With(new FontManagerOptions
{
FontFallbacks = new[]
try
{
BuildAvaloniaApp()
.With(new FontManagerOptions
{
FontFallbacks = new[]
{
new FontFallback
{
FontFamily = new FontFamily("Microsoft YaHei")
}
}
})
.StartWithClassicDesktopLifetime(args);
}
})
.StartWithClassicDesktopLifetime(args);
}
catch (Exception ex)
{
File.WriteAllText("error.log", ex.ToString());
}
}
public static AppBuilder BuildAvaloniaApp()

View File

@ -0,0 +1,7 @@
<linker>
<assembly fullname="AtomUI.Demo.Desktop" preserve="All"/>
<assembly fullname="AtomUI.Theme" preserve="All"/>
<assembly fullname="Avalonia.Base" preserve="All"/>
<assembly fullname="AtomUI.Controls" preserve="All"/>
<assembly fullname="Avalonia.Remote.Protocol" preserve="All"/>
</linker>

View File

@ -21,6 +21,6 @@ public class EnumExtension : MarkupExtension
// Array can not perform well for Items of ListBox.
// Version : 11.0.0-preview4
// By nlb at 2023.3.28.
return Enum.GetValues(Type).OfType<object>().ToList();
return Enum.GetValuesAsUnderlyingType(Type).OfType<object>().ToList();
}
}