© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
7 replies
Sher

❔ Read files from a library

I created a simle library using .NET 7. I have
.json
.json
and
.css
.css
files in this lib which I need to access during runtime. I tried to use
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>

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?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

reading files from a directory
C#CC# / help
2y ago
❔ Read bits from a byte[] array
C#CC# / help
3y ago
✅ referencing `WebApplication` from a class library
C#CC# / help
3y ago
❔ Implementing security from a web library
C#CC# / help
3y ago