❔ How to edit a .json file from project files?
I tried bunch of different solutions but they all just edited the .json file in
"bin\Debug\net6.0\"
, can I change the original file from the project files?11 Replies
you could use an absolute path...
yeah I just tried that and it worked 😕 👍
you could also use a relative path: ../../../something.json
typically you wouldn't want to do that
Do you mean don't use absolute path, relative path, or the entire concept of editing source files from build artifacts?
it definitely makes no sense to do this
your project source files aren't going to exist when the application is deployed
I agree
if this is a JSON file that the application relies on, it needs to be added to the output folders, where the application will be able to access it, reliably
if it's a JSON file you're just trying to load for testing or something, then it's your job as the user to give the file location to the program as input
maybe as a command-line argument
or by having the application popup an open file dialog
if you're just screwing around with something, temporarily, feel free to hard-code the absolute-path of the file
just don't keep that as a permanent thing
I see lots of folks trying this to maintain state between executions unfortunately
which is fine
put the file where it belongs then
it's not a source file, its a deployment state file
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.