Search code examples
c#uwpvisual-studio-app-center

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


I have try to add App Center in my project. My project has structure :

  1. Blank App(Universal Windows) c++(TestAppCenter)
  2. Windows Runtime Component(Universial Window) C#(CheckCrashComponent)

enter image description here

I have add app center in project (CheckCrashComponent). Get Started with UWP

enter image description here

I call init in my project (TestAppCenter) like below : enter image description here

it show error :

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

'Microsoft.AppCenter.Analytics, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

enter image description here

I have search on goolge but not find solution . If you meet the problem like me , please show me what i wrong in this case .Thank you very much !!!


Solution

  • Please replace class method with static method like below.

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

    Call Steps

     TestAppCenterCore::CoreRuntime::InitAppCenter;