Hi,
I have winforms application and it has reference to library MyLibrary.
MyLibrary has method:
string[] GiveMeNamesOfAirports()
{
string[] lines= File.ReadLines("airports.txt");
foreach(string line in lines)
...
}
And when I run my Winforms application:
I get error:
file couldn't be find.
I was trying other function:
string[] lines = File.ReadAllLines(Path.Combine(System.Environment.CurrentDirectory, "airports.txt"));
string[] lines = File.ReadAllLines(Path.Combine(Assembly.GetExecutingAssembly().Location, "airports.txt"));
string[] lines = File.ReadAllLines(Path.Combine(Assembly.GetAssembly(typeof(Airport)).Location, "airports.txt"));
File is in project MyLibrary ( I see it in solution, and it is in folder of MyLibrary.
I set Copy to ouptput directory to Copy always, and Build Action to Content.