ā Reading file from the folder where .csproj is
How can i read files from folder where .csproj is? just like webapps allow to do, they do not copy files
Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);don't working
4 Replies
for simplicity let's say they are .html
but i need to change them at runtime for easier debugging
folder would looks like this:
because i want to at runtime change content and be able to refresh
otherwise i have to open some /bin/net7/ folder to edit them what is really invonvinient
so you want to change an html file?
yes, at runtime
but then i need to copy file again back
just tell me how can i do this š
if idea end up being wrong, i will change later
i need it only for debugging
i assume i can set "current directory" to be ../../../ or smth like this
^ i will do this only for some functions, they will in debug seek for files in ../../../ folder
Environment.CurrentDirectory - is ending always
/bin/debug/net7/
? sometimes seen it is slightly different
i mean, i need to go 3 folders up, hope it doesn't change
though there is some magic global variable holding path of .csproj
š
one more question, how the hell can i configure "CopyToOutputDirectory" to copy entire folder?
???
yea, recursive
does it copy files only when they has changed?
it means it may behave better with large files
right now it's only 20KB in total, but i assume as number and size will growth, i will need to wait longer to start debugging
right?
as i said, i will create some "MyFilesProvider" which holds root directory, in debug it will be "../../../", in release the current directory
i'm not doing standard web or console app š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.