Explicitly marks Spectre.Console.Cli as not trimmable and not appropriate for AOT scenarios. Additionally adds a warning to CommandApp for users who may try it.

This commit is contained in:
Phil Scott 2024-11-20 09:50:22 -05:00 committed by Patrik Svensson
parent e1d21e7e61
commit 2a8810affd
3 changed files with 10 additions and 1 deletions

View File

@ -5,6 +5,9 @@ namespace Spectre.Console.Cli;
/// <summary>
/// The entry point for a command line application.
/// </summary>
#if !NETSTANDARD2_0
[RequiresDynamicCode("Spectre.Console.Cli relies on reflection. Use during trimming and AOT compilation is not supported and may result in unexpected behaviors.")]
#endif
public sealed class CommandApp : ICommandApp
{
private readonly Configurator _configurator;

View File

@ -6,6 +6,9 @@ namespace Spectre.Console.Cli;
/// The entry point for a command line application with a default command.
/// </summary>
/// <typeparam name="TDefaultCommand">The type of the default command.</typeparam>
#if !NETSTANDARD2_0
[RequiresDynamicCode("Spectre.Console.Cli relies on reflection. Use during trimming and AOT compilation is not supported and may result in unexpected behaviors.")]
#endif
public sealed class CommandApp<TDefaultCommand> : ICommandApp
where TDefaultCommand : class, ICommand
{

View File

@ -4,7 +4,10 @@
<TargetFrameworks>net9.0;net8.0;netstandard2.0</TargetFrameworks>
<IsPackable>true</IsPackable>
</PropertyGroup>
<PropertyGroup>
<IsAotCompatible Condition="'$(TargetFramework)' != 'netstandard2.0'" >false</IsAotCompatible>
<IsTrimmable>false</IsTrimmable>
</PropertyGroup>
<ItemGroup Label="REMOVE THIS">
<InternalsVisibleTo Include="Spectre.Console.Cli.Tests" />
</ItemGroup>