I have a .NET Framework Windows Service application that uses reference DLLs to fetch data from a device. I’ve created a Windows Setup Project to install the service. The setup builds successfully, and the service installs and runs as expected.
As I already added LibG5Client.CommunicatorWithSVC.SingletonCommunicatorWithSVC this dll as reference in my applciation.
However, when I attempt to attach the debugger to the running service from Visual Studio, I encounter below excpetion
System.TypeInitializationException
HResult=0x80131534
Message=The type initializer for ‘Azbil.IF4DevG5ExApp.LibG5Client.CommunicatorWithSVC.SingletonCommunicatorWithSVC’ threw an exception.
Source=LibG5Client
StackTrace:
at Azbil.IF4DevG5ExApp.LibG5Client.CommunicatorWithSVC.SingletonCommunicatorWithSVC.Instance()
at Azbil.IF4DevG5ExApp.LibG5Client.G5Client..ctor()
at BespokeWindowsService.G5ClientService.StartUpClient(XDocument& xDoc) in D:WindowsServiceNewBespokeWindowsServiceG5ClientService.cs:line 29
at BespokeWindowsService.DeviceDataFetcher.DoWork() in D:WindowsServiceNewBespokeWindowsServiceDeviceDataFetcher.cs:line 61
This exception was originally thrown at this call stack:
[External Code]
Inner Exception 1:
FileLoadException: Could not load file or assembly ‘System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
I want the solution for the mentioned exception enter image description here
Harshal Bhojane is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.