Ikram Khan
Ikram Khan

Reputation: 1

C# Error after installation. Could not load file or assembly 'Newtonsoft.Json

in C# windows forms, I am creating a chat client to connect nodejs server (Socekt.io). I am using SocketIoClientDotNet.dll in C#. While in visual studio debug mode, all is well. But when I install the app through creating the installer of the app, it is giving the following error when I call the socket.Emit('func',data) function.

Could not load file or assembly 'Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) File name: 'Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'

This is the line where exception is occurring:

socket.Emit("msg", "text", txtMessage.Text, receiverId, senderId);

Upvotes: 0

Views: 237

Answers (1)

Matthiee
Matthiee

Reputation: 493

Make sure the Newtonsoft.Json.dll file is included in the installer.

You could also try (re)installing the SocketIoClientDotNet using NuGet.

PM> Install-Package SocketIoClientDotNet

Upvotes: 1

Related Questions