23. December 2009 09:58
There is an another way how to get path to a running assembly from itself besides I mentioned here. Use this simple snippet:
string cmd = Environment.GetCommandLineArgs();
string path_to_assembly = cmd;
/* cmd and above contains command line arguments is any */
Resulting array is at least one element length or longer. First element of this array always contains path to the assembly. As a side effect – you can get command line params beginning from second element.
Unfortunately doesn’t work in .NET Compact Framework.
Technorati Tags: C#