开发者

Including text files in the published application

I made an application with C# and it reads text files located on my hard drive开发者_如何学JAVA but how do I publish the application and include these text files in the final exe so when the application is installed on a different computer it would work and not fail because it cannot locate the text files? I'm using Visual Studio2010


In properties for the file in Visual Studio, change the Build Action from None (probably) to Content, or store it as a Resource file depending on where it needs to end up.

Of course if you are writing an installer just add it to the installed components.


This might not be exactly what you want, but you can do like this:

Create a folder, for example on your Desktop, and call it something, like MyProject.

Get the .exe file (from NameOfYourProject → bin → Debug → NameOfYourProject.exe) and put it into the folder togeather with the .txt file

(If you have your .txt file in a folder like Debug → myFolder → myTextFile you can just put the whole "myFolder"-folder in MyProject togeather with the .exe file)

Create a New → WinRAR ZIP-archive and call it something, like MyProject.zip and drag the "MyProject"-folder onto it.

Now you can upload the MyProject.zip anywhere and users can unzip the files on their computers.

This works but is probably not a decorous way of doing it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜