In order to locate where a .NET executable has been loaded from, you can simply write:
var assembly = System.Reflection.Assembly.GetExecutingAssembly (); var dir = System.IO.Path.GetDirectoryName (assembly.Location);
This will return the path of the containing folder, not a
URI as you would get back by using
.CodeBase instead of
(see this Stack Overflow question
on the topic).