Salih Teamsah

Salih Teamsah

  • NA
  • 6
  • 2.7k

Access Resources from published application

Jul 23 2013 6:24 AM

I embedded some .txt files in the Resources folder. When I run the project, according to selection, the .txt file name is determined.

For example;

The file name is sample017.txt and I keep on textName string variable. This file's full path is :

"../../Resources\" + textName;

And I assign all of this to fileName string variable:

fileName = "../../Resources\\" + textName;

So, I use this string variable for streaming text file:

using (Stream input = File.OpenRead(fileName))

In this form, I can access to sample017.txt file and it works fine in Debugging mode.. But, when I build a setup project and install it any PC, It crashes into an Exception and it can't find the "Resources" folder. How do I manage the same using the Resources in the .exe file folder?

Note: I don't want to copy files to program folder. I want to embed these sources.


Answers (2)