I have a vb.net project that reads from multiple JSON files during execution. When I create a NuGet package of this project and try to use the package in a test solution, I get an exception saying that the JSON file could not be found. In the exception message (I'll attach it below), it shows that the program is looking at the file location of the test solution. Ideally, I want the JSON file to "live" inside of the NuGet package so the path to the file is constant.
The stranger thing about this issue is that I pushed a package the same way, using the JSON files, about a year ago and had no issues then. I only have a couple of years of experience so forgive me if my explanation of this issue isn't clear.
Inside the package solution, I'm using IO.File.ReadAllText(filename)
to access the JSON file. Could this be problematic when using the package as a reference in other solutions?
Example of the Solution looking for the JSON file in the Test Solution, not inside the package
In the package solution, I've set all the JSON to Copy Always
for the Copy To Output Directory
field.