UWP/C++/Windows 运行时组件 - 无法加载文件或程序集 'Microsoft.AppCenter.Analytics

UWP/C++/Windows Runtime Component - Could not load file or assembly 'Microsoft.AppCenter.Analytics

我尝试在我的项目中添加 App Center。我的项目有结构:

  1. 空白应用程序(通用 Windows)c++(TestAppCenter)
  2. Windows 运行时组件(通用 Window)C#(CheckCrashComponent)

我在项目(CheckCrashComponent)中添加了应用中心。 Get Started with UWP

我在我的项目 (TestAppCenter) 中调用 init,如下所示:

显示错误:

WinRT information: System.IO.FileNotFoundException: Could not load file or assembly 

'Microsoft.AppCenter.Analytics, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' 或其依赖项之一。系统找不到指定的文件。

我在 goolge 上搜索但没有找到解决方案。如果你遇到像我这样的问题,请告诉我我在这种情况下的错误。非常感谢你!!!

请将 class 方法替换为 static 方法,如下所示。

public static void  InitAppCenter()
{
    AppCenter.Start("11e4a636-6fa0-43b3-b2ee-dfde1f83axxxx", typeof(Analytics), typeof(Crashes));  
}

调用步骤

 TestAppCenterCore::CoreRuntime::InitAppCenter;