.NET WinForms: Cound not load System.Runtime

0

I was writing an app for a friend who wanted an easy way to use Morse Code.

I was attempting to use an External Library that I wrote with Morse Code support, and when I try to call it, I get this error, in an External "Control.cs" file. I found happened in both Visual Studio and JB Rider, though Visual Studio gives a different error as it can't debug external sources.

My usings are:

using CainsSharpTools; // <= This is my Library
using System.Diagnostics;
using System.Windows.Forms;

And my function call looks like this:

private void buttonEncode_Click(object sender, System.EventArgs e)
            => textBoxMorse.Text = MorseCode.Parse(textBoxPlain.Text).Value;

The error is

System.IO.FileLoadException: Could not load file or assembly 'System.Runtime, Version=4.2.2.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)
  at at MorseCoder.Form1.buttonEncode_Click(Object sender, EventArgs e)
  at at System.Windows.Forms.Control.OnClick(EventArgs e)
  at at System.Windows.Forms.Button.OnClick(EventArgs e)
  at at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
  at at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
  at at System.Windows.Forms.Control.WndProc(Message& m)
  at at System.Windows.Forms.ButtonBase.WndProc(Message& m)
  at at System.Windows.Forms.Button.WndProc(Message& m)
  at at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
  at at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
  at at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
  at at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
  at at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
  at at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
  at at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
  at at System.Windows.Forms.Application.Run(Form mainForm)
  at MorseCoder.Program.Main() in C:\Users\caina\source\repos\MorseCoder\MorseCoder\Program.cs:19
c#
.net
winforms
asked on Stack Overflow May 6, 2020 by cain a • edited May 6, 2020 by cain a

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0