I am looking to get the directory of my application it seems to be different from regular c#?
As in Path.GetDirectoryName(Application.ExecutablePath)
is not working.
I am looking to get the directory of my application it seems to be different from regular c#?
As in Path.GetDirectoryName(Application.ExecutablePath)
is not working.
One correct and cross-platform solution would be
Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)
Note that both Environment.CurrentDirectory
and Assembly.GetExecutingAssembly().Location
(more exactly, the directory thereof) are semantically wrong even though they are often - but not always - the same directory:
Assembly.GetExecutingAssembly()
, it would result in "/path/to/B.dll".Try Assembly.GetExecutingAssembly().Location