I was facing a similar issue, I had a file on my project, and wanted to test a class which had to deal with loading files from the FS and process them some way. What I did was:
test.txt
to my test projectalt-enter
(file properties)BuildAction
to Content
and Copy to Output Directory
to Copy if newer
, I guess Copy always
would have done it as wellthen on my tests I just had to Path.Combine(Environment.CurrentDirectory, "test.txt")
and that's it. Whenever the project is compiled it will copy the file (and all it's parent path, in case it was in, say, a folder) to the bin\Debug
(or whatever configuration you are using) folder.
Hopes this helps someone