@ledien We've identified a fix and we're pursuing a public doc update.
In the meantime here's how to consume a C# WinRT component from C++/WinRT
Could not load file or assembly 'Microsoft.AppCenter.Analytics, Version=0.0.0.0, Culture=neutral ...
ledien
1
Reputation point
I have project UWP by c++ name: TestAppCenter and " Window Runtime Component" by C# name :CoreRuntime .I have added "App center SDK" by install Microsoft.AppCenter.Analytics and Microsoft.AppCenter.Crashes packages for "CoreRuntime" .
In project UWP (TestAppCenter ) i call to function in CoreRuntime to init app center like :
App::App()
{
InitializeComponent();
Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending);
//CoreRuntime::Class1 ^ob = ref new Class1();
//ob->InitAppCenter();
CoreRuntime::Class1::InitAppCenter();
}
But 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**.
Here is my source test :
//Class1.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AppCenter;
using Microsoft.AppCenter.Analytics;
using Microsoft.AppCenter.Crashes;
namespace CoreRuntime
{
public sealed class Class1
{
public static void InitAppCenter()
{
AppCenter.Start("afc4f213-f02e-4f74-ae42-6386100bdaf8", typeof(Analytics), typeof(Crashes));
}
}
}
//App.xaml.cpp
App::App()
{
InitializeComponent();
Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending);
//CoreRuntime::Class1 ^ob = ref new Class1();
//ob->InitAppCenter();
CoreRuntime::Class1::InitAppCenter();//<--- call here.
}
I try call this function with static method , instance object. Could you please show me why it generate this error ? And solution for this .
Thank!!
1 answer
Sort by: Most helpful
-
AlexanderSklar 11 Reputation points
2020-04-22T01:07:55.16+00:00