部署WinForm应用程序后找不到嵌入的文本文件。 [英] Embedded Text file is not found after deploy WinForm application.

查看:60
本文介绍了部署WinForm应用程序后找不到嵌入的文本文件。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好!

文本文件A.txt位于资源文件夹中。我的应用程序从文本文件中检索信息,但它在调试时工作正常。部署应用程序文件后找不到错误。我认为有一些路径问题。如何访问嵌入文本文件并在部署.exe后操作它。



i知道如何访问嵌入式文件但是在部署之后我知道任何事情。



谢谢。

解决方案

将文本文件添加为资源的标准方法是:



1.打开Solution Explorer / Properties



2.双击Resources.resx



3.从顶部菜单中选择:添加资源/添加现有文件



这将打开一个标准的文件打开对话框:选择文件,单击打开



您选择的文件现在将被复制到项目的Resources文件夹中,并且应该包含在部署包中。



访问文件内容(文本):



string resText = Properties.Resources.NameOfYourResource; //不包括文件扩展名



如果以这种方式添加的文本文件未正确部署,则下一步是仔细查看您的部署方式。

Hello !
A text file A.txt is located in resources folder. My application retrieve information from text file but its working fine on debug. After deploy application file does not located error comes. I think there is some Path issue. how to access Embed text file and manipulate it after deploy .exe.

i know how to access embedded file but after deployment i din know anything.

Thanks.

解决方案

The standard way to add a Text File as a resource is:

1. open Solution Explorer/Properties

2. double-click on Resources.resx

3. select from top menu: Add Resource/Add Existing File

That will open a standard file-open dialog: select the file, click "Open"

The file you selected will now be copied into the Resources folder of your Project, and should be included in the deployment package.

To access the file contents (Text):

string resText = Properties.Resources.NameOfYourResource; // not including file extension

If a Text File added in that way does not deploy properly, then the next step is to look closely at how you are doing deployment.


这篇关于部署WinForm应用程序后找不到嵌入的文本文件。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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