0

我正在尝试使用 Microsoft 应用认证工具包测试我的 UWP 应用程序以将其提交到商店。我唯一的问题是:

在应用程序的 onlaunched 方法实现中,确保您处理 launchactivatedeventargs.prelaunch 选项以感知预启动事件

我从未更改过它,我使用的是 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 等来自此链接 的 App Certification failed because of PreLaunch Test

有什么建议么?谢谢! Microsoft 应用程序认证工具包失败结果

4

2 回答 2

1

是的,这是通过 WACK 的一种方式。有时即使之前没有通过WACK,包裹也可以通过商店认证。

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

因为 store 会测试你在 .NET Native 模式下提交的包,所以你会通过勾选“Compile with .NET tool chain”来通过认证。

另外,这里有一篇关于 .NET Native 的文章,你可以参考一下。

于 2016-10-28T10:22:16.257 回答
0

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

如果在Build部分的Project Property下,我检查了“ Compile with.NET Native tool chain ”,现在结果是Passed

Visual Studio 2015 > 项目属性

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

于 2016-10-27T14:13:15.120 回答