在 Visual Studio 中存储文本文件 [英] Storing text files in Visual Studio

查看:87
本文介绍了在 Visual Studio 中存储文本文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在我正在 Visual Studio 中读取 C# 代码中的文本文件.文本文件保存在我的计算机上,每当我们想在另一台计算机上运行代码时,我们必须更改代码中文本文件的路径,以便它可以工作.我的问题是,有没有什么地方可以保存项目中的文本文件,这样你就不必每次都更改路径来在不同的计算机上运行它?

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?

推荐答案

将 txt 文件添加到项目中.就像任何其他文件一样,在源代码管理中管理它们.

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.

这篇关于在 Visual Studio 中存储文本文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆