C#C
C#4y ago
11 replies
DaVinki

How to use relative path in referenced project within same solution?

I made a project for a simple Person object. In this project, I include a resources directory that contains a names.txt.

I use a relative path to the text file in my Person project but when I run the program, the directory isn't correct.

The path is Person/Resources/names.txt but comes out to be SolutionDirectory\bin\Debug\net6.0\Person\Resources\names.txt in the error where the entire relative path doesn't exist. It ends at net6.0. Is there a way I can include resources from other projects into the running project's bin?
Was this page helpful?