如何将外部文件添加到C#应用程序? [英] How to add the external file to C# application?

查看:111
本文介绍了如何将外部文件添加到C#应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只想在C#桌面应用程序中添加外部文件来存储查询。在那我想将每个查询添加为字符串。

I just want to add the external file in C# desktop application to store the queries. In that I want to add each query as string. And will take out of the file when needed.

1)如何在C#桌面应用程序中添加外部文件。
2)我如何从我的应用程序访问文件?

1) How to add external file in C# desktop application. 2) How can i access the file from my application?

预先感谢。

推荐答案

有两个选项:


  1. 将文件添加到项目并设置复制到输出文件夹选项。然后确保使用应用程序部署文件。

  1. Add the file to the project and set the "Copy to Output Folder" option. Then make sure you deploy the file with the application.

使文件成为嵌入式资源。然后它将成为exe的一部分,您无需处理单独的文件即可进行部署。

Make the file an embedded resource. Then it becomes part of the exe and you don't have to deal with a separate file for deployment.

这篇关于如何将外部文件添加到C#应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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