'FileLoadException: Could not load file or assembly 'Microsoft.AspNetCore.SignalR.Core
I'm creating a .net core console application where some of the libraries are using SignalR.
I have installed "Microsoft.AspNetCore.SignalR.Core" from nuget package manager and also added the same in Program.cs file as below.
class Program
{
static void Main(string[] args)
{
var host = CreateDefaultBuilder().Build();
using IServiceScope serviceScope = host.Services.CreateScope();
IServiceProvider provider = serviceScope.ServiceProvider;
var workerInstance = provider.GetRequiredService<Worker>();
workerInstance.DoWork();
host.Run();
}
static IHostBuilder CreateDefaultBuilder()
{
return Host.CreateDefaultBuilder()
.ConfigureAppConfiguration(app =>
{
app.AddJsonFile("appsettings.json");
})
.ConfigureServices(services =>
{
services.AddSignalRCore();
services.AddSignalR();
});
}
}
I have added AddSignalRCore in the ConfigurationServices. Is there any anywhere else I need to add the reference or is there any other step missing? Because when I run the code, it gives an error:
FileLoadException: Could not load file or assembly 'Microsoft.AspNetCore.SignalR.Core, Version=3.1.0.0, Culture=neutral, PublicKeyToken=XXXXXXXXXXXXXXXX'. The located assembly's manifest definition does not match the assembly reference. (0x80131040)
Solution 1:[1]
Can you take a screenshot of your csproj package management file? I did not find Microsoft.AspNetCore.SignalR.Core, Version=3.1.0.0. This version.
How you want to use SignalR in combination with asp.net core can download these packages:
Server NuGet Package?
Client NuGet packages?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Tupac |
