C# .Net Framework Class Library proj - Newtonsoft.Json gives "The system cannot find the file specified..." error

124 views Asked by At

The project is a Class Library which I want to use it from a Visual Foxpro application. Visual Foxpro is 32bit.

.Net project:

  • Target framework .Net Framework 4.7.2
  • Target Platform x86.
  • Using Newtonsoft.Json and RestSharp

I registered the DLL using RegAsm and I am able to create an object of that from Visual Foxpro. Things are fine, if I simply do some string manipulation and I am getting return value from DLL into Visual Foxpro program.

Now, when I enable RestSharp, it breaks and throws below error:

*OLE IDispatch exception code 0 from System.Memory: Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified... * I am not sure how this version conflict came up when I installed packages afresh and have not copied any file manually.

Any clue?

Thanks in advance Rajesh

My Visual Foxpro test folder is different and I have copied all files from my .Net Debug folder into that folder.

0

There are 0 answers