mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-15 00:12:50 +08:00
Add Native AOT support documentation and update project files for AOT compatibility
This commit is contained in:
parent
8f2a859087
commit
835143d95f
@ -96,6 +96,31 @@ Spectre.Console has an [analyzer](https://www.nuget.org/packages/Spectre.Console
|
|||||||
common errors in writing console output from above such as using multiple live rendering widgets simultaneously,
|
common errors in writing console output from above such as using multiple live rendering widgets simultaneously,
|
||||||
or using the static `AnsiConsole` class when `IAnsiConsole` is available.
|
or using the static `AnsiConsole` class when `IAnsiConsole` is available.
|
||||||
|
|
||||||
|
### Native AOT Support
|
||||||
|
|
||||||
|
Publishing your app as Native AOT with Spectre.Console produces an app that's self-contained and has been ahead-of-time (AOT) compiled to native code. Native AOT apps have faster startup time and smaller memory footprints. These apps can run on machines that don't have the .NET runtime installed.
|
||||||
|
|
||||||
|
To enable AOT support on your application, Add `<PublishAot>true</PublishAot>` to your project file.
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<PropertyGroup>
|
||||||
|
<PublishAot>true</PublishAot>
|
||||||
|
</PropertyGroup>
|
||||||
|
```
|
||||||
|
|
||||||
|
Current Spectre.Console support for AOT:
|
||||||
|
|
||||||
|
* ☑️ Spectre.Console
|
||||||
|
* ❌ Spectre.Console.Cli
|
||||||
|
* ☑️ Spectre.Console.Json
|
||||||
|
* ☑️ Spectre.Console.ImageSharp
|
||||||
|
|
||||||
|
Spectre.Console.Cli relies on reflection and discovering types at runtime, preventing it from currently supporting AOT.
|
||||||
|
|
||||||
|
Spectre.Console supports AOT, but with the following limitations
|
||||||
|
|
||||||
|
* `WriteException` will output a simple stacktrace and ignore any `ExceptionFormats` set.
|
||||||
|
|
||||||
### Configuring the Windows Terminal For Unicode and Emoji Support
|
### Configuring the Windows Terminal For Unicode and Emoji Support
|
||||||
|
|
||||||
Windows Terminal supports Unicode and Emoji. However, the shells such as Powershell and cmd.exe do not.
|
Windows Terminal supports Unicode and Emoji. However, the shells such as Powershell and cmd.exe do not.
|
||||||
|
@ -5,7 +5,10 @@
|
|||||||
<IsPackable>true</IsPackable>
|
<IsPackable>true</IsPackable>
|
||||||
<Description>A library that extends Spectre.Console with ImageSharp superpowers.</Description>
|
<Description>A library that extends Spectre.Console with ImageSharp superpowers.</Description>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<IsAotCompatible Condition="'$(TargetFramework)' != 'netstandard2.0'" >true</IsAotCompatible>
|
||||||
|
<PolySharpIncludeRuntimeSupportedAttributes>true</PolySharpIncludeRuntimeSupportedAttributes>
|
||||||
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="SixLabors.ImageSharp" />
|
<PackageReference Include="SixLabors.ImageSharp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>net9.0;net8.0;netstandard2.0</TargetFrameworks>
|
<TargetFrameworks>net9.0;net8.0;netstandard2.0</TargetFrameworks>
|
||||||
<ImplicitUsings>true</ImplicitUsings>
|
<ImplicitUsings>true</ImplicitUsings>
|
||||||
<IsPackable>true</IsPackable>
|
<IsPackable>true</IsPackable>
|
||||||
<Description>A library that extends Spectre.Console with JSON superpowers.</Description>
|
<Description>A library that extends Spectre.Console with JSON superpowers.</Description>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<IsAotCompatible Condition="'$(TargetFramework)' != 'netstandard2.0'" >true</IsAotCompatible>
|
||||||
|
<PolySharpIncludeRuntimeSupportedAttributes>true</PolySharpIncludeRuntimeSupportedAttributes>
|
||||||
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="..\..\Spectre.Console\Internal\Extensions\CharExtensions.cs" Link="Internal\CharExtensions.cs" />
|
<Compile Include="..\..\Spectre.Console\Internal\Extensions\CharExtensions.cs" Link="Internal\CharExtensions.cs" />
|
||||||
<Compile Include="..\..\Spectre.Console\Internal\Extensions\EnumerableExtensions.cs" Link="Internal\EnumerableExtensions.cs" />
|
<Compile Include="..\..\Spectre.Console\Internal\Extensions\EnumerableExtensions.cs" Link="Internal\EnumerableExtensions.cs" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user