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

前端 未结 7 803
走了就别回头了
走了就别回头了 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:10

    From Solution Explorer, right click on myfile.txt and choose "Properties"

    From there, set the Build Action to content and Copy to Output Directory to either Copy always or Copy if newer

    enter image description here

提交回复
热议问题