C#
In a console application, output will be show in command prompt.
And i t will generate an .exe file for the user to execute the application.
Some users may need to read a text file from specific directory in the application.
Generally will using ConfigurationManager.AppSettings.Get("Directory");
To run the console application, user require the compile files(.exe, .config and other .dll or text file).
Source file is not required after compilation.
However, if compile file is moved to some others directory before execution, user are required to edit the path name of text file in .config file. If the compile file will be executed as portable(in different computer), user might need to change the path name manualy.
Here is an easy way to get the execute path name.
//add System.windows.Form Reference
{
String a = "";
a = System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath ) + "\\file.txt";
Console.WriteLine(a);
//See the output..
}
Showing posts with label Application. Show all posts
Showing posts with label Application. Show all posts
Thursday, March 27, 2008
Subscribe to:
Comments (Atom)