1

I'm working on a C# class library that will import a JSON configuration file. It's not a straightforward use case as there are some legacy odds and ends to maneuver around. It's also partly a knowledge journey.

I also don't have the time/money/support to do a full blown, SOLID, 100% covered TDD run at this. Technical debt is a thing, but I'll be can kicking for now.

With that out of the way..

I have two projects in my solution -

 ClassLibrary
 ClassLibrary_Implementer (Console Application)

I put the Json.Net nuget package in the ClassLibrary and just threw some code in to get started.

Then I implemented that class in the ClassLibrary_Implementer console application, where I get the following error

System.IO.FileNotFoundException: 'Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.'

I want to be able to load this class into a few applications without adding the Json.Net additional dependency. Is there a setting in Visual Studio to make this happen that I missed? I know my approach is not the proper way, but I don't think I'm that far out of bounds. I am rusty, so who knows.

Bmo
  • 1,212
  • 11
  • 34
  • 1
    Had the same problem: library was .net standart and console application was .net framework. I installed Newtonsoft.Json in both projects and that helped. By the way, I am not sure, that it’s correct to install same package in both projects, but I got demanded result. – Alex Sham Jan 28 '19 at 22:20
  • Take a look at this answer https://stackoverflow.com/questions/1132243/msbuild-doesnt-copy-references-dll-files-if-using-project-dependencies-in-sol – Khoa Jan 28 '19 at 23:04

0 Answers0