将文本文件添加到我的项目

时间:2023-01-13 20:41:32

I have developed a VB.NET application that generates code in a specific format. It has a multitude of features and everything works great. I recently added the ability to save generated code to a text file as well as the ability to load those text files into the application. I am looking to add one last feature (perk). I want to include a bunch of pre-coded text files with the application, that new users can load and use immediately. As of right now I have the application creating the directory they will go in, but can't find anything on how to include the text files and have them placed in that directory. This application uses one-click deployment (in case that matters). Any help would be greatly appreciated.

我开发了一个VB.NET应用程序,它以特定的格式生成代码。它具有众多功能,一切都很好。我最近添加了将生成的代码保存到文本文件的功能,以及将这些文本文件加载到应用程序的功能。我想添加最后一个功能(perk)。我想在应用程序中包含一堆预编码的文本文件,新用户可以立即加载和使用。截至目前,我有应用程序创建他们将进入的目录,但无法找到有关如何包含文本文件并将它们放在该目录中的任何内容。此应用程序使用一键部署(如果重要)。任何帮助将不胜感激。

1 个解决方案

#1


1  

First go to solution explorer and click Show All Files in the top menu. Then on each file you want to include right click and select Include In Project.

首先转到解决方案资源管理器,然后单击顶部菜单中的显示所有文件。然后在要包含的每个文件上单击鼠标右键,然后选择“包括在项目中”。

After you do that you need to go to properties of the .txt files in the Properties window in Visual Studio and set BuildAction as Content.

执行此操作后,您需要转到Visual Studio的“属性”窗口中的.txt文件的属性,并将BuildAction设置为“内容”。

#1


1  

First go to solution explorer and click Show All Files in the top menu. Then on each file you want to include right click and select Include In Project.

首先转到解决方案资源管理器,然后单击顶部菜单中的显示所有文件。然后在要包含的每个文件上单击鼠标右键,然后选择“包括在项目中”。

After you do that you need to go to properties of the .txt files in the Properties window in Visual Studio and set BuildAction as Content.

执行此操作后,您需要转到Visual Studio的“属性”窗口中的.txt文件的属性,并将BuildAction设置为“内容”。