UWP 应用认证 Launchactivatedeventargs.Prelaunch

UWP App Certification Launchactivatedeventargs.Prelaunch

我正在尝试测试我的 UWP 应用程序,以便使用 Microsoft App Certification Kit 将其提交到商店。我唯一的问题是:

in the onlaunched method implementation of the app, ensure you handle the launchactivatedeventargs.prelaunch option to be prelaunch event aware

我从未更改过它,我使用的是 Visual Studio

中的原始项目
sealed partial class App : Application
{
    /// <summary>
    /// Initializes the singleton application object.  This is the first line of authored code
    /// executed, and as such is the logical equivalent of main() or WinMain().
    /// </summary>
    public App()
    {
        this.InitializeComponent();
        this.Suspending += OnSuspending;
    }

    /// <summary>
    /// Invoked when the application is launched normally by the end user.  Other entry points
    /// will be used such as when the application is launched to open a specific file.
    /// </summary>
    /// <param name="e">Details about the launch request and process.</param>
    protected override async void OnLaunched(LaunchActivatedEventArgs e) {
    #if DEBUG
        if (System.Diagnostics.Debugger.IsAttached) {
            this.DebugSettings.EnableFrameRateCounter = true;
        }
    #endif
        Frame rootFrame = Window.Current.Content as Frame;

        // Do not repeat app initialization when the Window already has content,
        // just ensure that the window is active
        if (rootFrame == null) {
            // Create a Frame to act as the navigation context and navigate to the first page
            rootFrame = new Frame();

            rootFrame.NavigationFailed += OnNavigationFailed;

            if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) {
                //TODO: Load state from previously suspended application
            }

            // Place the frame in the current Window
            Window.Current.Content = rootFrame;
        }

        if (!e.PrelaunchActivated) {
            if (rootFrame.Content == null) {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                rootFrame.Navigate(typeof(FormView), e.Arguments);
            }

            // Ensure the current window is active
            Window.Current.Activate();
        }

        // Place the frame in the current Window
        Window.Current.Content = rootFrame;
    }

    /// <summary>
    /// Invoked when Navigation to a certain page fails
    /// </summary>
    /// <param name="sender">The Frame which failed navigation</param>
    /// <param name="e">Details about the navigation failure</param>
    void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
    {
        throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
    }

    /// <summary>
    /// Invoked when application execution is being suspended.  Application state is saved
    /// without knowing whether the application will be terminated or resumed with the contents
    /// of memory still intact.
    /// </summary>
    /// <param name="sender">The source of the suspend request.</param>
    /// <param name="e">Details about the suspend request.</param>
    private void OnSuspending(object sender, SuspendingEventArgs e)
    {
        var deferral = e.SuspendingOperation.GetDeferral();
        //TODO: Save application state and stop any background activity
        deferral.Complete();
    }
}

我用谷歌搜索了一下,但每个人都在谈论 UWP 的 Template10 这样的 link

有什么建议吗?谢谢!

我想我找到了解决办法,但也许这只是一个幸运的巧合。

如果在 Project 属性Build 部分,我检查了“Compile with.NET 本机工具链”,现在结果是通过

你认为这是正确的答案吗?

是的,这是一种通过 WACK 的方式。有时候包裹在之前WACK失败的情况下,也能通过店铺认证。

当您在“构建”部分的项目 属性 下测试您的项目时,然后选中 “使用 .NET 工具链编译”, 这意味着您 运行 您在“发布”中的项目 mode.by 默认您的应用程序使用 .NET Native 工具链。由于包被编译为本机二进制文件,因此包不需要包含 .NET 框架库。此外,该包依赖于最新安装的 .NET Native 运行time,而不是 CoreCLR 包。设备上的 .NET Native 运行time 将始终与您的应用程序包兼容。 通过“发布”配置进行的本地本地编译将使您能够在与客户体验相似的环境中测试您的应用程序。 在进行开发时定期测试这一点很重要。

由于store会以.NET Native方式测试您提交的包,勾选“Compile with .NET tool chain”即可通过认证。

另外,这里an article是关于.NET Native的,大家可以参考一下