How to get execution directory of console application

前端 未结 4 2062
北荒
北荒 2020-12-28 11:36

I tried to get the directory of the console application using the below code,

Assembly.GetExecutingAssembly().Location

but this one gives m

4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-28 11:56

    Use this :

    System.Reflection.Assembly.GetExecutingAssembly().Location
    

    Combine that with

    System.IO.Path.GetDirectoryName if all you want is the directory.
    

提交回复
热议问题