0

I have a class library in .NET Framework 4.7.2 and I use a reference to Newtonsoft.Json Version 12... something. Properties of the assembly

If I run the app as a windows application (there is a winform) everything works just fine. However, it is actually a class library that is being called by another program as a plugin. Inside that program I get however this error

Error Message

Which translates basically to "couldn't find the Assembly...". There Version=12.0.0.0 is begin referenced and the dll in that particular folder (the plugin folder) says version 12.0.3.23909 dll

I tried to clean the solution, delete every reference to newtonsoft I found etc. but the result is always identical. What am I missing?

Sorry if this question has been answered before, I searched dozens of previous questions, but I can't seem to understand what is going on appart from "redo everything", which doesn't work here.

UPDATE

The output bin is as followsenter image description here

If I change the program to a windows application and run it by calling the exe, it works, but not via the other program where it should run as a plugin. Interestingly, the core dll is being opened and the baseform works, but not newtonsoft.

rst
  • 2,510
  • 4
  • 21
  • 47

1 Answers1

0

Change at least one of the versions. I mean:

  • Change the version of Newtonsoft of your class library to -> 12.0.3.23909 and then build the class library and use it as a plugin.
  • Or change the Newtonsoft version of your project to 12.0.0 and then use your class lib as a plugin inside it.

Or:

You can carry Newtonsoft (12.0.0) with your class library and load both of Newtonsft and your class library as a plugin. (this works too but you should be aware of Dll conflict between 12.0.0 and 12.0.3)

Amir
  • 1,214
  • 7
  • 10
  • So this is what happened, I installed Newtonsoft with `Install-Package Newtonsoft.Json -Version 12.0.3` but still get the situation explained above. How do you do point 2? – rst Mar 19 '21 at 04:23
  • Please share a screenshot of your project output-dir (bin) with all of its contents. – Amir Mar 20 '21 at 08:41
  • I added the screenshot, all cleared stuff is just naming of the project – rst Mar 21 '21 at 07:07
  • Is COPY_LOCAL setting of your Newtonsoft DLL enabled? – Amir Mar 21 '21 at 16:22
  • Yes, look at the first image of the op – rst Mar 21 '21 at 21:17