This question has already been answered:
How to open this test.txt file from the program? For example, when processing a button press. 
This question has already been answered:
How to open this test.txt file from the program? For example, when processing a button press. 
A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .
Then you can:
var assembly = Assembly.GetExecutingAssembly(); var resourceName = assembly.GetName().Name + ".Resources.test.txt"; using (Stream stream = assembly.GetManifestResourceStream(resourceName)) using (StreamReader reader = new StreamReader(stream)) { string result = reader.ReadToEnd(); Console.Write(result); } Console.ReadLine(); But there is another option: change the properties of Copy to Output Directory to Copy always (I don’t know how it will be in Russian)
Then you can just
StreamReader streamReader = new StreamReader("Resources\\test.txt");
Use the GetManifestResourceStream method.
For example:
Assembly assembly = Assembly.GetExecutingAssembly(); using (Stream stream = assembly.GetManifestResourceStream("имя_файла")) using (StreamReader reader = new StreamReader(stream)) { string data = reader.ReadToEnd(); } Resources.test.txt and yes, the file should be marked as embeded in the properties. - MonkSource: https://ru.stackoverflow.com/questions/919890/
All Articles