I have a small WebApi project, and from inside this project I want to load a resource JSON file with some information. Inside my project I created a folder called Resources
, and inside this Resources
folder I added a data.json
file.
I want to know how can I use this data.json
file inside of my project. I did some reading and wasn't able to find a BuildAction that puts this resource file on the same directory as my binaries so I can use it.
I would like to do something like this:
string json = File.ReadAllText(@"..\Resources\data.json");
However if I do this I get this exception:
"Could not find a part of the path 'C:\Program Files (x86)\Resources\data.json'."
I understand very little about ASP.NET, but is there a way I can accomplish this?