How to read a text file in project's root directory?

前端 未结 7 819
走了就别回头了
走了就别回头了 2020-12-04 10:45

I want to read the first line of a text file that I added to the root directory of my project. Meaning, my solution explorer is showing the .txt file along side my .cs files

7条回答
  •  北荒
    北荒 (楼主)
    2020-12-04 11:14

    You have to use absolute path in this case. But if you set the CopyToOutputDirectory = CopyAlways, it will work as you are doing it.

提交回复
热议问题