C
C#2y ago
agudar

❔ 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
anita
anita2y ago
you could use an absolute path...
agudar
agudarOP2y ago
yeah I just tried that and it worked 😕 👍
anita
anita2y ago
you could also use a relative path: ../../../something.json
jcotton42
jcotton422y ago
typically you wouldn't want to do that
Mayor McCheese
Do you mean don't use absolute path, relative path, or the entire concept of editing source files from build artifacts?
JakenVeina
JakenVeina2y ago
it definitely makes no sense to do this your project source files aren't going to exist when the application is deployed
Mayor McCheese
I agree
JakenVeina
JakenVeina2y ago
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
Mayor McCheese
I see lots of folks trying this to maintain state between executions unfortunately
JakenVeina
JakenVeina2y ago
which is fine put the file where it belongs then it's not a source file, its a deployment state file
Accord
Accord2y ago
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.
Want results from more Discord servers?
Add your server