What is the best method of getting the path the C# executable is running from?
I need to use it for temp folders etc and currently I’m using:
Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase)
But I then need to do a:
.Replace("file:\\", string.Empty)
as this gives me a URI type path (i.e. has file:\ at the start) which is unusable with some other parts of my code.
Not an accurate answer to your question, however I would suggest to have a look at:
http://msdn.microsoft.com/en-us/library/system.io.path.gettempfilename.aspx