prepare aot

This commit is contained in:
vanzue
2025-12-03 13:58:00 +08:00
parent 514f7cb8d5
commit 1a82df1d7b
3 changed files with 8 additions and 37 deletions

View File

@@ -5,7 +5,6 @@
using System;
using System.Globalization;
using System.IO;
using System.Windows.Forms;
using Microsoft.CommandPalette.Extensions.Toolkit;
namespace PowerToysExtension.Commands;
@@ -30,7 +29,7 @@ internal sealed partial class CopyColorCommand : InvokableCommand
return CommandResult.ShowToast("No color found in Color Picker history.");
}
System.Windows.Forms.Clipboard.SetText(color);
ClipboardHelper.SetText(color);
return CommandResult.ShowToast($"Copied {color}");
}
catch (Exception ex)

View File

@@ -3,9 +3,6 @@
// See the LICENSE file in the project root for more information.
using System;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using ColorPicker.ModuleServices;
using Microsoft.CommandPalette.Extensions.Toolkit;
@@ -30,29 +27,7 @@ internal sealed partial class CopySavedColorCommand : InvokableCommand
{
try
{
if (Thread.CurrentThread.GetApartmentState() != ApartmentState.STA)
{
var tcs = new TaskCompletionSource<bool>();
var thread = new Thread(() =>
{
try
{
Clipboard.SetText(_copyValue);
tcs.SetResult(true);
}
catch (Exception ex)
{
tcs.SetException(ex);
}
});
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
tcs.Task.GetAwaiter().GetResult();
}
else
{
Clipboard.SetText(_copyValue);
}
ClipboardHelper.SetText(_copyValue);
return CommandResult.ShowToast($"Copied {_copyValue}");
}

View File

@@ -8,7 +8,7 @@
<ApplicationManifest>app.manifest</ApplicationManifest>
<PublishProfile>win-$(Platform).pubxml</PublishProfile>
<UseWinUI>false</UseWinUI>
<UseWindowsForms>true</UseWindowsForms>
<UseWindowsForms>false</UseWindowsForms>
<EnableMsixTooling>true</EnableMsixTooling>
<GenerateAppxPackageOnBuild>true</GenerateAppxPackageOnBuild>
<OutputPath>$(SolutionDir)$(Platform)\$(Configuration)\WinUI3Apps\CmdPalExtensions\$(MSBuildProjectName)\</OutputPath>
@@ -64,15 +64,12 @@
<!-- Exclude legacy Helper folder in favor of Helpers -->
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<PublishTrimmed>true</PublishTrimmed>
<PublishSingleFile>true</PublishSingleFile>
<PropertyGroup>
<!-- Always build/publish AOT so the extension ships as native code -->
<SelfContained>true</SelfContained>
<PublishAot>true</PublishAot>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<PublishTrimmed>false</PublishTrimmed>
<PublishSingleFile>false</PublishSingleFile>
<PublishAot>false</PublishAot>
<PublishTrimmed>true</PublishTrimmed>
<DisableRuntimeMarshalling>false</DisableRuntimeMarshalling>
</PropertyGroup>
</Project>