Files
AppKit/samples/AppKit.Sample.WinUI/Program.cs
T
james.maesandCodex 8cbd3d1154 fix(samples): keep Velopack startup visible to its packer
Call VelopackApp.Build().Run() directly in both sample entry points and the
README integration example. The packer cannot recognize the indirect wrapper.
Retain VelopackStartup for compatibility and document the static-check limit.

Validation: zero-warning x64 solution build, solution formatting, fourteen UI
tests across both samples. Real starter packing accepts the direct call.

Refs: #11, #20, #21
Co-Authored-By: Codex (GPT-6) <noreply@openai.com>
Signed-off-by: James Maes <james@kof22.com>
2026-10-10 15:50:01 -05:00

34 lines
1.0 KiB
C#

/*
* Copyright (c) 2026 James Maes (KofTwentyTwo)
* SPDX-License-Identifier: MIT
*/
using Microsoft.UI.Dispatching;
using Velopack;
namespace AppKit.Sample.WinUI;
/// <summary>
/// Custom entry point (DISABLE_XAML_GENERATED_MAIN) so Velopack handles its install,
/// update, and uninstall hooks before any UI exists.
/// </summary>
public static class Program
{
/// <summary>Runs Velopack&apos;s install and update hooks first, then starts the WinUI application (the XAML-generated Main is disabled for this).</summary>
[STAThread]
private static void Main()
{
// vpk checks the entry assembly for this direct call before packaging.
VelopackApp.Build().Run();
// The remainder mirrors the XAML-generated Main.
WinRT.ComWrappersSupport.InitializeComWrappers();
Microsoft.UI.Xaml.Application.Start(callbackParams =>
{
SynchronizationContext.SetSynchronizationContext(new DispatcherQueueSynchronizationContext(DispatcherQueue.GetForCurrentThread()));
_ = new App();
});
}
}