How to get the path of app(without app.exe)?

前端 未结 7 1927
梦如初夏
梦如初夏 2020-12-09 06:28

I want to get the path of my app like: \"\\\\ProgramFiles\\\\myApp\", I try to use the following code:


string path = System.Reflection.Assembly.GetExecuting         


        
7条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-09 06:47

    More simple than the rest:

    using System.IO;
    using System.Reflection;
    ...
    var path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)
    

提交回复
热议问题