Storing text files in Visual Studio

谁都会走 提交于 2019-12-12 02:28:14

问题


Right now I am reading in text files in my C# code in Visual Studio. The text files are saved onto my computer and whenever we want to run the code on another computer, we have to change the path for the text file within the code so it will work. My question is, is there any place you can save the text files within the project so that you do not have to change the path everytime to run it on different computers?


回答1:


Add the txt files to the project. Manage them in your source control just like any other file.

You can add any kind of file you like. They just sit there doing nothing ( it doesn't try to compile them or anything), you can group them into folders for better clarity.




回答2:


You can add a folder to your project to hold the various text files:

  • Right mouse click on your project
  • Select Add New Folder

You can place any type of file into this folder.

Hope this helps.



来源:https://stackoverflow.com/questions/9561331/storing-text-files-in-visual-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!