❔ Read files from a library
I created a simle library using .NET 7. I have
.json
and .css
files in this lib which I need to access during runtime. I tried to use
But files get copied to the library output directory, so the main project can't read them.
I can access files using full path to them, but this way I will need to know the ralative path all the time, which I don't really like.
How can fix the issue?4 Replies
What is reading the files?
e.g. a browser, or you're using a .net assembly to ingest those files?
your files should be copied to the output directory, period
if any project is using your lib, these files should be copied to the main project output dir, with your .dlls too
CopyToOutputDirectory
does not actually do that
it is actually pretty difficult to make this specific scenario work
i agree, can you explain more about how these files are used. it will determine which options are good and which ones aren'tWas 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.