extra : if you are working on a Class Library project you have to embed the settings.json
file.
A class library shouldn't really be directly referencing anything inapp.config - the class doesn't have an app.config, because it's not anapplication, it's a class.
- Go to the JSON file's properties.
- Change Build Action -> Embedded resource.
- Use the following code to read it.
var assembly = Assembly.GetExecutingAssembly();
var resourceStream = assembly.GetManifestResourceStream("Assembly.file.json");
string myString = reader.ReadToEnd();
now we have a JSON string we can Deserialize it using JsonConvert
if you didn't embed the file inside the assembly you can't use only the DLL file without the file